|
@@ -82,6 +82,23 @@ func ModRevision(key string) Cmp {
|
|
|
return Cmp{Key: []byte(key), Target: pb.Compare_MOD}
|
|
return Cmp{Key: []byte(key), Target: pb.Compare_MOD}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// KeyBytes returns the byte slice holding with the comparison key.
|
|
|
|
|
+func (cmp *Cmp) KeyBytes() []byte { return cmp.Key }
|
|
|
|
|
+
|
|
|
|
|
+// WithKeyBytes sets the byte slice for the comparison key.
|
|
|
|
|
+func (cmp *Cmp) WithKeyBytes(key []byte) { cmp.Key = key }
|
|
|
|
|
+
|
|
|
|
|
+// ValueBytes returns the byte slice holding the comparison value, if any.
|
|
|
|
|
+func (cmp *Cmp) ValueBytes() []byte {
|
|
|
|
|
+ if tu, ok := cmp.TargetUnion.(*pb.Compare_Value); ok {
|
|
|
|
|
+ return tu.Value
|
|
|
|
|
+ }
|
|
|
|
|
+ return nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// WithValueBytes sets the byte slice for the comparison's value.
|
|
|
|
|
+func (cmp *Cmp) WithValueBytes(v []byte) { cmp.TargetUnion.(*pb.Compare_Value).Value = v }
|
|
|
|
|
+
|
|
|
func mustInt64(val interface{}) int64 {
|
|
func mustInt64(val interface{}) int64 {
|
|
|
if v, ok := val.(int64); ok {
|
|
if v, ok := val.(int64); ok {
|
|
|
return v
|
|
return v
|