Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chenquan/zero-sqlx
zero-sqlx is a database orm framework based on go-zero implementation that supports read/write separation between leader and follower databases.
https://github.com/chenquan/zero-sqlx
go-zero leader-follower mysql orm pgsql postgresql read-write-separation
Last synced: 4 months ago
JSON representation
zero-sqlx is a database orm framework based on go-zero implementation that supports read/write separation between leader and follower databases.
- Host: GitHub
- URL: https://github.com/chenquan/zero-sqlx
- Owner: chenquan
- License: apache-2.0
- Created: 2023-05-22T00:50:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-24T00:56:16.000Z (7 months ago)
- Last Synced: 2024-09-28T18:21:29.229Z (4 months ago)
- Topics: go-zero, leader-follower, mysql, orm, pgsql, postgresql, read-write-separation
- Language: Go
- Homepage:
- Size: 116 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zero-sqlx
zero-sqlx supports leader-follower read-write separation.
## installation
```shell
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
```yaml
DB:
Leader: leader
Followers:
- follower1
- follower2
``````go
type Config struct{
DB DBConf
}
``````go
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")
```