Skip to content

Commit

Permalink
add support for json_set
Browse files Browse the repository at this point in the history
Test cases are included.
Related to #127
  • Loading branch information
mkanilsson committed Feb 4, 2025
1 parent 3478352 commit a8e3ae7
Show file tree
Hide file tree
Showing 7 changed files with 446 additions and 16 deletions.
2 changes: 1 addition & 1 deletion COMPAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ Modifiers:
| jsonb_remove(json,path,...) | | |
| json_replace(json,path,value,...) | | |
| jsonb_replace(json,path,value,...) | | |
| json_set(json,path,value,...) | | |
| json_set(json,path,value,...) | Yes | |
| jsonb_set(json,path,value,...) | | |
| json_type(json) | Yes | |
| json_type(json,path) | Yes | |
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions core/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub enum JsonFunc {
JsonPatch,
JsonRemove,
JsonPretty,
JsonSet,
}

#[cfg(feature = "json")]
Expand All @@ -105,6 +106,7 @@ impl Display for JsonFunc {
Self::JsonPatch => "json_patch".to_string(),
Self::JsonRemove => "json_remove".to_string(),
Self::JsonPretty => "json_pretty".to_string(),
Self::JsonSet => "json_set".to_string(),
}
)
}
Expand Down Expand Up @@ -540,6 +542,8 @@ impl Func {
"json_remove" => Ok(Self::Json(JsonFunc::JsonRemove)),
#[cfg(feature = "json")]
"json_pretty" => Ok(Self::Json(JsonFunc::JsonPretty)),
#[cfg(feature = "json")]
"json_set" => Ok(Self::Json(JsonFunc::JsonSet)),
"unixepoch" => Ok(Self::Scalar(ScalarFunc::UnixEpoch)),
"julianday" => Ok(Self::Scalar(ScalarFunc::JulianDay)),
"hex" => Ok(Self::Scalar(ScalarFunc::Hex)),
Expand Down
Loading

0 comments on commit a8e3ae7

Please sign in to comment.