nap
nap copied to clipboard
A Go sql.DB wrapper for master-slave topologies
This is useful when using postgres database, github.com/lib/pq driver does not implement LastInsertId() func so there is no other way to get auto-incremental id by running Exec, which means we...
https://github.com/tsenart/nap/blob/a650a3fbb7be164e08bb105f6a6a6fbc18dc54d3/db.go#L101 here might need some kind of locking over stmts variable.
Can I use this with the gorm(https://github.com/jinzhu/gorm). If yes, can you give any example code(noob here).
[It looks like](https://github.com/tsenart/pan/blob/master/db.go#L122) if a slave dies, some % of slave requests will simply fail. Feature request: support failure detection, and some kind of circuit-breaker recovery mechanism.