How to support master slave and multiple database?
@levinalex Can you add file config for database connection open with multi shard and master/slave?
like active_record sharding https://github.com/zendesk/active_record_shards
you could have a load balancer, and make gorm connect the load balancer
Just for future reference in case anyone else stumbles upon this issue, for master slave topologies you can use https://github.com/tsenart/nap to add client side load balancing. For multi-master topologies like CockroachDB I wrote a library https://github.com/d4l3k/go-lbsql.
There's also https://github.com/benthor/clustersql but it seems to have some issues and not be thread safe.
@d4l3k Could you please share an example with gorm and tsenart/nap ?
Most helpful comment
@d4l3k Could you please share an example with gorm and tsenart/nap ?