-
Notifications
You must be signed in to change notification settings - Fork 13
/
mysql.go
42 lines (35 loc) · 856 Bytes
/
mysql.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package pipeline
import "github.com/go-mysql-org/go-mysql/mysql"
// Mysql store struct
type Mysql struct {
Address string `json:"address"`
Port uint16 `json:"port"`
User string `json:"user"`
Password string `json:"password"`
ServerId uint32 `json:"server_id"`
Flavor Flavor `json:"flavor"`
Mode Mode `json:"mode"`
}
// Mode mysql replication mode
type Mode string
const (
// MODE_GTID GTID Mode
MODE_GTID Mode = "gtid"
// MODE_POSITION common Mode
MODE_POSITION Mode = "position"
)
// Flavor mysql or mariaDB
type Flavor string
const (
// FLAVOR_MYSQL MySQL DB
FLAVOR_MYSQL Flavor = "MySQL"
// FLAVOR_MARIADB MariaDB
FLAVOR_MARIADB Flavor = "MariaDB"
)
// YaString convert binlogo flavor string
func (f Flavor) YaString() string {
if f == FLAVOR_MARIADB {
return mysql.MariaDBFlavor
}
return mysql.MySQLFlavor
}