Skip to content

zero-sqlx is a database orm framework based on go-zero implementation that supports read/write separation between leader and follower databases

License

Notifications You must be signed in to change notification settings

chenquan/zero-sqlx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

About

zero-sqlx is a database orm framework based on go-zero implementation that supports read/write separation between leader and follower databases

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages