Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 618 Bytes

README.md

File metadata and controls

44 lines (32 loc) · 618 Bytes

zero-sqlx

zero-sqlx supports leader-follower read-write separation.

installation

go get github.com/chenquan/zero-sqlx

features

  • Full tracing
  • Read and write separation
  • Allows specified leader db execution
  • Adaptive circuit breaker
  • P2c algorithm

how to use it

DB:
  Leader: leader
  Followers:
    - follower1
    - follower2
type Config struct{
  DB DBConf
}
var c config.Config
conf.MustLoad(*configFile, &c, conf.UseEnv())


mysql := NewMultipleSqlConn("mysql", c.DB)
var name string
mysql.QueryRow(&name, "SELECT name FROM user WHERE id = 1")