Skip to content

Commit 07f7364

Browse files
jonahgeorgesiddontang
authored andcommitted
Add Clone() method to GTIDSet (go-mysql-org#259)
1 parent d6fc3d1 commit 07f7364

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

mysql/gtid.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ type GTIDSet interface {
1313
Contain(o GTIDSet) bool
1414

1515
Update(GTIDStr string) error
16+
17+
Clone() GTIDSet
1618
}
1719

1820
func ParseGTIDSet(flavor string, s string) (GTIDSet, error) {

mysql/mariadb_gtid.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,9 @@ func (gtid *MariadbGTID) Update(GTIDStr string) error {
8989

9090
return nil
9191
}
92+
93+
func (gtid *MariadbGTID) Clone() GTIDSet {
94+
clone := new(MariadbGTID)
95+
*clone = *gtid
96+
return clone
97+
}

mysql/mysql_gtid.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,3 +427,9 @@ func (s *MysqlGTIDSet) Encode() []byte {
427427

428428
return buf.Bytes()
429429
}
430+
431+
func (gtid *MysqlGTIDSet) Clone() GTIDSet {
432+
clone := new(MysqlGTIDSet)
433+
*clone = *gtid
434+
return clone
435+
}

0 commit comments

Comments
 (0)