This commit is contained in:
Ihor Andrianov 2025-02-10 15:34:47 +02:00
parent aad0522f56
commit b8b0f860d7
No known key found for this signature in database
2 changed files with 5 additions and 7 deletions

View file

@ -41,7 +41,6 @@ type IsMaxNumber = bool;
fn collect_num(current: i128, adding: i128, negative: bool) -> (i128, IsMaxNumber) {
let ten = 10i128;
let adding = adding as i128;
let result = if negative {
current.saturating_mul(ten).saturating_sub(adding)
@ -230,12 +229,12 @@ fn handle_quoted_key<'a>(
Ok(())
}
fn handle_array_index<'a>(
fn handle_array_index(
ch: (usize, char),
parser_state: &mut PPState,
index_state: &mut ArrayIndexState,
index_buffer: &mut i128,
path_components: &mut Vec<PathElement<'a>>,
path_components: &mut Vec<PathElement<'_>>,
path_iter: &mut std::str::CharIndices,
path: &str,
) -> crate::Result<()> {

View file

@ -225,7 +225,7 @@ pub fn json_arrow_shift_extract(
}
let json = get_json_value(value)?;
let extracted = json_extract_single(&json, path, false)?.unwrap_or_else(|| &Val::Null);
let extracted = json_extract_single(&json, path, false)?.unwrap_or(&Val::Null);
convert_json_to_db_type(extracted, true)
}
@ -242,7 +242,7 @@ pub fn json_extract(value: &OwnedValue, paths: &[OwnedValue]) -> crate::Result<O
return Ok(OwnedValue::Null);
} else if paths.len() == 1 {
let json = get_json_value(value)?;
let extracted = json_extract_single(&json, &paths[0], true)?.unwrap_or_else(|| &Val::Null);
let extracted = json_extract_single(&json, &paths[0], true)?.unwrap_or(&Val::Null);
return convert_json_to_db_type(extracted, false);
}
@ -256,8 +256,7 @@ pub fn json_extract(value: &OwnedValue, paths: &[OwnedValue]) -> crate::Result<O
return Ok(OwnedValue::Null);
}
_ => {
let extracted =
json_extract_single(&json, path, true)?.unwrap_or_else(|| &Val::Null);
let extracted = json_extract_single(&json, path, true)?.unwrap_or(&Val::Null);
if paths.len() == 1 && extracted == &Val::Null {
return Ok(OwnedValue::Null);