镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions local_examples/cmds_hash/redis-py/cmds_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
print(hdel1)
# >>> 1

hdel2 = r.hget("myhash", "field1")
hdel2 = r.hdel("myhash", "field1")
print(hdel2)
# >>> 1

hdel3 = r.hget("myhash", "field2")
hdel3 = r.hdel("myhash", "field2")
print(hdel3)
# >>> 0

# REMOVE_START
assert hdel1 == 1
assert hdel2 == "foo"
assert hdel3 == None
assert hdel2 == 1
assert hdel3 == 0
r.delete("myhash")
# REMOVE_END
# STEP_END
Expand Down
22 changes: 11 additions & 11 deletions local_examples/cmds_hash/rust-async/cmds_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ mod cmds_hash_tests {
}
}

match r.hget("myhash", "field1").await {
match r.hdel("myhash", "field1").await {
Ok(hdel2) => {
let hdel2: Option<String> = hdel2;
let hdel2: Option<i32> = hdel2;
match hdel2 {
Some(value) => {
println!("{value}"); // >>> foo
println!("{value}"); // >>> 1
// REMOVE_START
assert_eq!(value, "foo");
assert_eq!(value, 1);
// REMOVE_END
},
None => {
Expand All @@ -64,20 +64,20 @@ mod cmds_hash_tests {
}
}

match r.hget("myhash", "field2").await {
match r.hdel("myhash", "field2").await {
Ok(hdel3) => {
let hdel3: Option<String> = hdel3;
let hdel3: Option<i32> = hdel3;
match hdel3 {
Some(_) => {
println!("Some value");
Some(value) => {
println!("{value}"); // >>> 0
// REMOVE_START
panic!("Expected None but got Some");
assert_eq!(value, 0);
// REMOVE_END
},
None => {
println!("None"); // >>> None
println!("None");
// REMOVE_START
assert!(hdel3.is_none());
panic!("Expected value but got None");
// REMOVE_END
}
}
Expand Down
22 changes: 11 additions & 11 deletions local_examples/cmds_hash/rust-sync/cmds_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ mod cmds_hash_tests {
}
}

match r.hget("myhash", "field1") {
match r.hdel("myhash", "field1") {
Ok(hdel2) => {
let hdel2: Option<String> = hdel2;
let hdel2: Option<i32> = hdel2;
match hdel2 {
Some(value) => {
println!("{value}"); // >>> foo
println!("{value}"); // >>> 1
// REMOVE_START
assert_eq!(value, "foo");
assert_eq!(value, 1);
// REMOVE_END
},
None => {
Expand All @@ -64,20 +64,20 @@ mod cmds_hash_tests {
}
}

match r.hget("myhash", "field2") {
match r.hdel("myhash", "field2") {
Ok(hdel3) => {
let hdel3: Option<String> = hdel3;
let hdel3: Option<i32> = hdel3;
match hdel3 {
Some(_) => {
println!("Some value");
Some(value) => {
println!("{value}"); // >>> 0
// REMOVE_START
panic!("Expected None but got Some");
assert_eq!(value, 0);
// REMOVE_END
},
None => {
println!("None"); // >>> None
println!("None");
// REMOVE_START
assert!(hdel3.is_none());
panic!("Expected value but got None");
// REMOVE_END
}
}
Expand Down
Loading