Skip to content

Commit

Permalink
Merge pull request #8488 from purpleidea/feat/leaseid-helper
Browse files Browse the repository at this point in the history
clientv3: Add LeaseValue helper to Cmp LeaseID values in Txn
  • Loading branch information
xiang90 authored Sep 5, 2017
2 parents 9a84c84 + 550765d commit b1595f2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clientv3/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ func ModRevision(key string) Cmp {
return Cmp{Key: []byte(key), Target: pb.Compare_MOD}
}

// LeaseValue compares a key's LeaseID to a value of your choosing. The empty
// LeaseID is 0, otherwise known as `NoLease`.
func LeaseValue(key string) Cmp {
return Cmp{Key: []byte(key), Target: pb.Compare_LEASE}
}

// KeyBytes returns the byte slice holding with the comparison key.
func (cmp *Cmp) KeyBytes() []byte { return cmp.Key }

Expand Down

0 comments on commit b1595f2

Please sign in to comment.