Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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