(o Position)
| 13 | } |
| 14 | |
| 15 | func (p Position) Compare(o Position) int { |
| 16 | // First compare binlog name |
| 17 | nameCmp := CompareBinlogFileName(p.Name, o.Name) |
| 18 | if nameCmp != 0 { |
| 19 | return nameCmp |
| 20 | } |
| 21 | // Same binlog file, compare position |
| 22 | if p.Pos > o.Pos { |
| 23 | return 1 |
| 24 | } else if p.Pos < o.Pos { |
| 25 | return -1 |
| 26 | } else { |
| 27 | return 0 |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func (p Position) String() string { |
| 32 | return fmt.Sprintf("(%s, %d)", p.Name, p.Pos) |