clientv3: translate WithPrefix() into WithFromKey() for empty key

This commit is contained in:
Anthony Romano 2017-04-16 20:46:33 -07:00
parent f0143916de
commit f92c11e1f2

View File

@ -282,6 +282,10 @@ func getPrefix(key []byte) []byte {
// can return 'foo1', 'foo2', and so on.
func WithPrefix() OpOption {
return func(op *Op) {
if len(op.key) == 0 {
op.key, op.end = []byte{0}, []byte{0}
return
}
op.end = getPrefix(op.key)
}
}