Skip to content

Commit 088d493

Browse files
committed
replication: add IsEmpty method to GTIDSet interface & implementations
1 parent f8d108d commit 088d493

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

mysql/gtid.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type GTIDSet interface {
1717
Update(GTIDStr string) error
1818

1919
Clone() GTIDSet
20+
21+
// IsEmpty returns true if the given set is empty and false otherwise.
22+
IsEmpty() bool
2023
}
2124

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

mysql/mariadb_gtid.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,7 @@ func (s *MariadbGTIDSet) Contain(o GTIDSet) bool {
256256

257257
return true
258258
}
259+
260+
func (s *MariadbGTIDSet) IsEmpty() bool {
261+
return len(s.Sets) == 0
262+
}

mysql/mysql_gtid.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,3 +596,7 @@ func (gtid *MysqlGTIDSet) Clone() GTIDSet {
596596

597597
return clone
598598
}
599+
600+
func (s *MysqlGTIDSet) IsEmpty() bool {
601+
return len(s.Sets) == 0
602+
}

0 commit comments

Comments
 (0)