mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
expose op.isOptsWithFromKey and op.isOptsWithPrefix
Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
This commit is contained in:
parent
a639ecd4ee
commit
06579d9cd1
@ -124,6 +124,10 @@ func (op Op) IsKeysOnly() bool { return op.keysOnly }
|
||||
// IsCountOnly returns whether countOnly is set.
|
||||
func (op Op) IsCountOnly() bool { return op.countOnly }
|
||||
|
||||
func (op Op) IsOptsWithFromKey() bool { return op.isOptsWithFromKey }
|
||||
|
||||
func (op Op) IsOptsWithPrefix() bool { return op.isOptsWithPrefix }
|
||||
|
||||
// MinModRev returns the operation's minimum modify revision.
|
||||
func (op Op) MinModRev() int64 { return op.minModRev }
|
||||
|
||||
|
@ -78,24 +78,28 @@ func TestIsSortOptionValid(t *testing.T) {
|
||||
|
||||
func TestIsOptsWithPrefix(t *testing.T) {
|
||||
optswithprefix := []OpOption{WithPrefix()}
|
||||
if !IsOptsWithPrefix(optswithprefix) {
|
||||
op := OpGet("key", optswithprefix...)
|
||||
if !IsOptsWithPrefix(optswithprefix) || !op.IsOptsWithPrefix() {
|
||||
t.Errorf("IsOptsWithPrefix = false, expected true")
|
||||
}
|
||||
|
||||
optswithfromkey := []OpOption{WithFromKey()}
|
||||
if IsOptsWithPrefix(optswithfromkey) {
|
||||
op = OpGet("key", optswithfromkey...)
|
||||
if IsOptsWithPrefix(optswithfromkey) || op.IsOptsWithPrefix() {
|
||||
t.Errorf("IsOptsWithPrefix = true, expected false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsOptsWithFromKey(t *testing.T) {
|
||||
optswithfromkey := []OpOption{WithFromKey()}
|
||||
if !IsOptsWithFromKey(optswithfromkey) {
|
||||
op := OpGet("key", optswithfromkey...)
|
||||
if !IsOptsWithFromKey(optswithfromkey) || !op.IsOptsWithFromKey() {
|
||||
t.Errorf("IsOptsWithFromKey = false, expected true")
|
||||
}
|
||||
|
||||
optswithprefix := []OpOption{WithPrefix()}
|
||||
if IsOptsWithFromKey(optswithprefix) {
|
||||
op = OpGet("key", optswithprefix...)
|
||||
if IsOptsWithFromKey(optswithprefix) || op.IsOptsWithFromKey() {
|
||||
t.Errorf("IsOptsWithFromKey = true, expected false")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user