mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
Merge 'Various JSON improvements' from Ihor Andrianov
Added jsonb_object, jsonb_array, json_insert, jsonb_insert. MongoDB is sweating now. Closes #1160
This commit is contained in:
@@ -73,12 +73,14 @@ pub enum JsonFunc {
|
||||
Json,
|
||||
Jsonb,
|
||||
JsonArray,
|
||||
JsonbArray,
|
||||
JsonArrayLength,
|
||||
JsonArrowExtract,
|
||||
JsonArrowShiftExtract,
|
||||
JsonExtract,
|
||||
JsonbExtract,
|
||||
JsonObject,
|
||||
JsonbObject,
|
||||
JsonType,
|
||||
JsonErrorPosition,
|
||||
JsonValid,
|
||||
@@ -87,6 +89,8 @@ pub enum JsonFunc {
|
||||
JsonbRemove,
|
||||
JsonReplace,
|
||||
JsonbReplace,
|
||||
JsonInsert,
|
||||
JsonbInsert,
|
||||
JsonPretty,
|
||||
JsonSet,
|
||||
JsonQuote,
|
||||
@@ -102,12 +106,14 @@ impl Display for JsonFunc {
|
||||
Self::Json => "json".to_string(),
|
||||
Self::Jsonb => "jsonb".to_string(),
|
||||
Self::JsonArray => "json_array".to_string(),
|
||||
Self::JsonbArray => "jsonb_array".to_string(),
|
||||
Self::JsonExtract => "json_extract".to_string(),
|
||||
Self::JsonbExtract => "jsonb_extract".to_string(),
|
||||
Self::JsonArrayLength => "json_array_length".to_string(),
|
||||
Self::JsonArrowExtract => "->".to_string(),
|
||||
Self::JsonArrowShiftExtract => "->>".to_string(),
|
||||
Self::JsonObject => "json_object".to_string(),
|
||||
Self::JsonbObject => "jsonb_object".to_string(),
|
||||
Self::JsonType => "json_type".to_string(),
|
||||
Self::JsonErrorPosition => "json_error_position".to_string(),
|
||||
Self::JsonValid => "json_valid".to_string(),
|
||||
@@ -116,6 +122,8 @@ impl Display for JsonFunc {
|
||||
Self::JsonbRemove => "jsonb_remove".to_string(),
|
||||
Self::JsonReplace => "json_replace".to_string(),
|
||||
Self::JsonbReplace => "jsonb_replace".to_string(),
|
||||
Self::JsonInsert => "json_insert".to_string(),
|
||||
Self::JsonbInsert => "jsonb_insert".to_string(),
|
||||
Self::JsonPretty => "json_pretty".to_string(),
|
||||
Self::JsonSet => "json_set".to_string(),
|
||||
Self::JsonQuote => "json_quote".to_string(),
|
||||
@@ -565,12 +573,16 @@ impl Func {
|
||||
#[cfg(feature = "json")]
|
||||
"json_array" => Ok(Self::Json(JsonFunc::JsonArray)),
|
||||
#[cfg(feature = "json")]
|
||||
"jsonb_array" => Ok(Self::Json(JsonFunc::JsonbArray)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_extract" => Ok(Func::Json(JsonFunc::JsonExtract)),
|
||||
#[cfg(feature = "json")]
|
||||
"jsonb_extract" => Ok(Func::Json(JsonFunc::JsonbExtract)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_object" => Ok(Func::Json(JsonFunc::JsonObject)),
|
||||
#[cfg(feature = "json")]
|
||||
"jsonb_object" => Ok(Func::Json(JsonFunc::JsonbObject)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_type" => Ok(Func::Json(JsonFunc::JsonType)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_error_position" => Ok(Self::Json(JsonFunc::JsonErrorPosition)),
|
||||
@@ -585,6 +597,10 @@ impl Func {
|
||||
#[cfg(feature = "json")]
|
||||
"json_replace" => Ok(Self::Json(JsonFunc::JsonReplace)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_insert" => Ok(Self::Json(JsonFunc::JsonInsert)),
|
||||
#[cfg(feature = "json")]
|
||||
"jsonb_insert" => Ok(Self::Json(JsonFunc::JsonbInsert)),
|
||||
#[cfg(feature = "json")]
|
||||
"jsonb_replace" => Ok(Self::Json(JsonFunc::JsonReplace)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_pretty" => Ok(Self::Json(JsonFunc::JsonPretty)),
|
||||
|
||||
Reference in New Issue
Block a user