Skip to content

Commit

Permalink
Update README (#950)
Browse files Browse the repository at this point in the history
* Update README

* Update example about GTID

* Add description to examples

* Add 'go mod edit' line

* Remove donate and feedback sessions, add credits

---------

Signed-off-by: lance6716 <[email protected]>
Co-authored-by: lance6716 <[email protected]>
  • Loading branch information
dveeden and lance6716 authored Dec 6, 2024
1 parent 506416d commit 615af30
Showing 1 changed file with 36 additions and 29 deletions.
65 changes: 36 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# go-mysql

A pure go library to handle MySQL network protocol and replication.
A pure go library to handle MySQL network protocol and replication as used by MySQL and MariaDB.

![semver](https://img.shields.io/github/v/tag/go-mysql-org/go-mysql)
![example workflow](https://github.com/go-mysql-org/go-mysql/actions/workflows/ci.yml/badge.svg)
![gomod version](https://img.shields.io/github/go-mod/go-version/go-mysql-org/go-mysql/master)

## How to migrate to this repo
To change the used package in your repo it's enough to add this `replace` directive to your `go.mod`:
```
replace github.com/siddontang/go-mysql => github.com/go-mysql-org/go-mysql v1.10.0
```

v1.10.0 - is the last tag in repo, feel free to choose what you want.
[![Go Reference](https://pkg.go.dev/badge/github.com/go-mysql-org/go-mysql.svg)](https://pkg.go.dev/github.com/go-mysql-org/go-mysql)

## Changelog
This repo uses [Changelog](CHANGELOG.md).

---
# Content
* [Replication](#replication)
* [Incremental dumping](#canal)
* [Client](#client)
* [Fake server](#server)
* [database/sql like driver](#driver)
* [Logging](#logging)
* [Replication](#replication) - Process events from a binlog stream.
* [Incremental dumping](#canal) - Sync from MySQL to Redis, Elasticsearch, etc.
* [Client](#client) - Simple MySQL client.
* [Fake server](#server) - server side of the MySQL protocol, as library.
* [database/sql like driver](#driver) - An alternative `database/sql` driver for MySQL.
* [Logging](#logging) - Custom logging options.
* [Migration](#how-to-migrate-to-this-repo) - Information for how to migrate if you used the old location of this project.

## Examples

The `cmd` directory contains example applications that can be build by running `make build` in the root of the project. The resulting binaries will be places in `bin/`.

- `go-binlogparser`: parses a binlog file at a given offset
- `go-canal`: streams binlog events from a server to canal
- `go-mysqlbinlog`: streams binlog events
- `go-mysqldump`: like `mysqldump`, but in Go
- `go-mysqlserver`: fake MySQL server

## Replication

Expand Down Expand Up @@ -55,9 +59,10 @@ syncer := replication.NewBinlogSyncer(cfg)
streamer, _ := syncer.StartSync(mysql.Position{binlogFile, binlogPos})

// or you can start a gtid replication like
// gtidSet, _ := mysql.ParseGTIDSet(mysql.MySQLFlavor, "de278ad0-2106-11e4-9f8e-6edd0ca20947:1-2")
// streamer, _ := syncer.StartSyncGTID(gtidSet)
// the mysql GTID set likes this "de278ad0-2106-11e4-9f8e-6edd0ca20947:1-2"
// the mariadb GTID set likes this "0-1-100"
// the mysql GTID set is like this "de278ad0-2106-11e4-9f8e-6edd0ca20947:1-2" and uses mysql.MySQLFlavor
// the mariadb GTID set is like this "0-1-100" and uses mysql.MariaDBFlavor

for {
ev, _ := streamer.GetEvent(context.Background())
Expand Down Expand Up @@ -111,7 +116,7 @@ Query: DROP TABLE IF EXISTS `test_replication` /* generated by server */

## Canal

Canal is a package that can sync your MySQL into everywhere, like Redis, Elasticsearch.
Canal is a package that can sync your MySQL into everywhere, like Redis, Elasticsearch.

First, canal will dump your MySQL data then sync changed data using binlog incrementally.

Expand Down Expand Up @@ -161,7 +166,7 @@ func main() {
}
```

You can see [go-mysql-elasticsearch](https://github.com/siddontang/go-mysql-elasticsearch) for how to sync MySQL data into Elasticsearch.
You can see [go-mysql-elasticsearch](https://github.com/go-mysql-org/go-mysql-elasticsearch) for how to sync MySQL data into Elasticsearch.

## Client

Expand Down Expand Up @@ -516,17 +521,19 @@ import "github.com/siddontang/go-log/log"

Or you can implement your own [`log.Handler`](https://pkg.go.dev/github.com/siddontang/go-log/log#Handler).

## Donate

If you like the project and want to buy me a cola, you can through:

|PayPal|微信|
|------|---|
|[![](https://www.paypalobjects.com/webstatic/paypalme/images/pp_logo_small.png)](https://paypal.me/siddontang)|[![](https://github.com/siddontang/blog/blob/master/donate/weixin.png)|
## How to migrate to this repo
To change the used package in your repo it's enough to add this `replace` directive to your `go.mod`:
```
replace github.com/siddontang/go-mysql => github.com/go-mysql-org/go-mysql v1.10.0
```

## Feedback
This can be done by running this command:
```
go mod edit -replace=github.com/siddontang/go-mysql=github.com/go-mysql-org/[email protected]
```

go-mysql is still in development, your feedback is very welcome.
v1.10.0 - is the last tag in repo, feel free to choose what you want.

## Credits

Gmail: siddontang@gmail.com
go-mysql was started by @siddontang and has many [contributors](https://github.com/go-mysql-org/go-mysql/graphs/contributors)

0 comments on commit 615af30

Please sign in to comment.