feat(redis): added and impl ZADDNX command (#3944)

This commit is contained in:
#Suyghur
2024-03-02 10:15:10 +08:00
committed by GitHub
parent a1bacd3fc8
commit 0ee44c7064
2 changed files with 57 additions and 0 deletions

View File

@@ -1584,6 +1584,24 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
})
}
func TestRedis_Zaddnx(t *testing.T) {
runOnRedis(t, func(client *Redis) {
ok, err := client.Zadd("key", 1, "value1")
assert.Nil(t, err)
assert.True(t, ok)
ok, err = client.Zaddnx("key", 2, "value1")
assert.Nil(t, err)
assert.False(t, ok)
ok, err = client.ZaddFloat("key", 1.1, "value2")
assert.Nil(t, err)
assert.True(t, ok)
ok, err = client.ZaddnxFloat("key", 1.1, "value3")
assert.Nil(t, err)
assert.True(t, ok)
})
}
func TestRedis_IncrbyFloat(t *testing.T) {
runOnRedis(t, func(client *Redis) {
incrVal, err := client.IncrbyFloat("key", 0.002)