MYDB
Connect with one master DB and multiple read replicas
MYDB is a GO package that provides an automatic route read-only queries to read replicas, and all other queries to the master DB (see diagram below), without the user having to be aware of it.
This package is very similiar to package database/sql
.
To start using mydb, install Go and run go get
:
go get -u github.com/rosspatil/sql-db-mocking
This will retrieve the library.
Get the instance of DB Object and perform generic sql operations. You have to provide one master db instance and atleast one replica instance
func New(master *sql.DB, readreplicas ...*sql.DB) (*DB, error)