Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
rename variable
  • Loading branch information
gkorland committed May 18, 2020
commit 0557990f3823dcbe2ea24ec7187751319922483e
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ fn json_set(ctx: &Context, args: Vec<String>) -> RedisResult {
match (current, set_option) {
(Some(ref mut doc), ref op) => {
if doc.set_value(&value, &path, op, format)? {
if let Some(index) = value_index {
index::add_document(&key, &index.index_name, &doc)?;
if let Some(value_index) = value_index {
index::add_document(&key, &value_index.index_name, &doc)?;
}
ctx.replicate_verbatim();
REDIS_OK
Expand All @@ -139,12 +139,12 @@ fn json_set(ctx: &Context, args: Vec<String>) -> RedisResult {
if path == "$" {
redis_key.set_value(&REDIS_JSON_TYPE, doc)?;

if let Some(index) = value_index {
if let Some(value_index) = value_index {
// FIXME: We need to get the value even though we just set it,
// since the original doc is consumed by set_value.
// Can we do better than this?
let doc = redis_key.get_value(&REDIS_JSON_TYPE)?.unwrap();
index::add_document(&key, &index.index_name, doc)?;
index::add_document(&key, &value_index.index_name, doc)?;
}
ctx.replicate_verbatim();
REDIS_OK
Expand Down