Conversation
redisless/src/command.rs
Outdated
if let Some(key) = get_bytes_vec(v.get(1)) { | ||
if let Some(increment_bytes) = get_bytes_vec(v.get(2)) { | ||
if let Ok(increment_str) = std::str::from_utf8(&increment_bytes[..]) { | ||
if let Ok(increment) = increment_str.parse::<i64>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does INCRBY
should accept i64 instead of u64? Is it allowed to do INCRBY key -10
? If yes, can you add a test for that case? Ty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I double check this one because sound weird for me too but
https://redis.io/commands/incrby
64 bit signed integer
I tested and works as expected
127.0.0.1:6379> SET mykey "10"
OK
127.0.0.1:6379> INCRBY mykey 5
(integer) 15
127.0.0.1:6379> INCRBY mykey -5
(integer) 10
And also there is a test :)
redisless/src/server.rs
Outdated
let x: u32 = con.get("intkeyby").unwrap(); | ||
assert_eq!(x, 20u32); | ||
|
||
let _ = con |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evoxmusic INCRBY "-5" test here.
that weird, test are passing on my side
I will check. |
Let me know if you need help |
Hi @evoxmusic, can you try to run this branch locally ? Thx! This is the error in GH Actions.
|
@clarity0 looks good for you? (it looks good to me) |
Wait, sorry for the spam. The test continue to failing in GH. Let me try one more thing related to the test setup. |
ping @evoxmusic / @clarity0 now is ready to review and merge :). Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at my last comment, then we are all good 🥳
Thank you and congrats for your first accepted PR @pepoviola 🔥 |
Hi @evoxmusic, this pr implement "INCRBY" for #3 .
Thx!