Skip to content

Commit

Permalink
namespace: prefix comparison range_end
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Jun 15, 2017
1 parent 6c40d98 commit f2a3e0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clientv3/namespace/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ func (txn *txnPrefix) If(cs ...clientv3.Cmp) clientv3.Txn {
newCmps := make([]clientv3.Cmp, len(cs))
for i := range cs {
newCmps[i] = cs[i]
pfxKey, _ := txn.kv.prefixInterval(cs[i].KeyBytes(), nil)
pfxKey, endKey := txn.kv.prefixInterval(cs[i].KeyBytes(), cs[i].RangeEnd)
newCmps[i].WithKeyBytes(pfxKey)
if len(cs[i].RangeEnd) != 0 {
newCmps[i].RangeEnd = endKey
}
}
txn.Txn = txn.Txn.If(newCmps...)
return txn
Expand Down

0 comments on commit f2a3e0e

Please sign in to comment.