Skip to content

This repository demonstrate a library for sql to connect master and slave node with 100% test coverage.

Notifications You must be signed in to change notification settings

rosspatil/sql-db-mocking

Repository files navigation

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.

image.png

This package is very similiar to package database/sql.

Getting Started

Installing

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 and start using it

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)

About

This repository demonstrate a library for sql to connect master and slave node with 100% test coverage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published