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
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ serde_json = "1.0"
serde = "1.0"
libc = "0.2"
jsonpath_lib = { git = "https://github.com/RedisJSON/jsonpath.git", branch = "generic_json_path" }
#redis-module = { version="0.26", features = ["experimental-api"]}
redis-module = { git = "https://github.com/RedisLabsModules/redismodule-rs.git", branch="master", features = ["experimental-api"]}
redis-module = { version="1.0", features = ["experimental-api"]}
itertools = "0.10.1"
[features]
# Workaround to allow cfg(feature = "test") in redismodue-rs dependencies:
Expand Down
14 changes: 7 additions & 7 deletions src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,16 @@ macro_rules! redis_json_module_export_shared_api {
static REDISJSON_GETAPI: &str = concat!("RedisJSON_V1", "\0");

pub fn export_shared_api(ctx: &Context) {
ctx.log_notice("Exported RedisJSON_V1 API");
unsafe {
ctx.log_notice("Exported RedisJSON_V1 API");
LLAPI_CTX = Some(rawmod::RedisModule_GetThreadSafeContext.unwrap()(
std::ptr::null_mut(),
))
};
ctx.export_shared_api(
&JSONAPI as *const RedisJSONAPI_V1 as *const c_void,
REDISJSON_GETAPI.as_ptr() as *const c_char,
);
));
ctx.export_shared_api(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I do not understand the change, was this added to the unsafe block?

@oshadmi oshadmi Feb 22, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the function export_shared_api was changed to be unsafe

&JSONAPI as *const RedisJSONAPI_V1 as *const c_void,
REDISJSON_GETAPI.as_ptr() as *const c_char,
);
}
}

static JSONAPI: RedisJSONAPI_V1 = RedisJSONAPI_V1 {
Expand Down
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ pub fn command_json_clear<M: Manager>(
SelectValueType::Array | SelectValueType::Object => v.len().unwrap() > 0,
SelectValueType::Long => v.get_long() != 0,
SelectValueType::Double => v.get_double() != 0.0,
SelectValueType::String => v.get_str().len() > 0,
SelectValueType::String => !v.get_str().is_empty(),
SelectValueType::Bool => v.get_bool(),
_ => false,
})?;
Expand Down
4 changes: 2 additions & 2 deletions src/ivalue_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn update<F: FnMut(&mut IValue) -> Result<Option<()>, Error>>(
let mut v = e.get_mut();
match (func)(&mut v) {
Ok(res) => {
if let None = res {
if res.is_none() {
e.remove();
}
}
Expand All @@ -152,7 +152,7 @@ fn update<F: FnMut(&mut IValue) -> Result<Option<()>, Error>>(
let mut v = &mut arr.as_mut_slice()[x];
match (func)(&mut v) {
Ok(res) => {
if let None = res {
if res.is_none() {
arr.remove(x);
}
}
Expand Down