21 Star 48 Fork 14

siddontang / go-mysql

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
position.go 528 Bytes
一键复制 编辑 原始数据 按行查看 历史
siddontang 提交于 2015-01-20 15:47 . add position string
package mysql
import (
"fmt"
)
// For binlog filename + position based replication
type Position struct {
Name string
Pos uint32
}
func (p Position) Compare(o Position) int {
// First compare binlog name
if p.Name > o.Name {
return 1
} else if p.Name < o.Name {
return -1
} else {
// Same binlog file, compare position
if p.Pos > o.Pos {
return 1
} else if p.Pos < o.Pos {
return -1
} else {
return 0
}
}
}
func (p Position) String() string {
return fmt.Sprintf("(%s, %d)", p.Name, p.Pos)
}
Go
1
https://gitee.com/siddontang/go-mysql.git
git@gitee.com:siddontang/go-mysql.git
siddontang
go-mysql
go-mysql
04766b6d37d1

搜索帮助