pub enum UpdateOp {
Set {
path: FieldPath,
value: Option<Value>,
},
Merge {
path: Option<MergePath>,
value: Value,
},
Increment {
path: FieldPath,
by: i64,
},
Decrement {
path: FieldPath,
by: i64,
},
Append {
path: Option<MergePath>,
value: Value,
},
Remove {
path: FieldPath,
},
}Expand description
Operations that can be performed atomically on a stream value
Variants§
Set
Set a value at path (overwrite)
Merge
Merge object into existing value (object-only). Path may be
omitted (root merge), a single first-level key, or an array of
literal segments for nested merge. See MergePath.
Increment
Increment numeric value
Decrement
Decrement numeric value
Append
Append an element to an array or concatenate a string at the
optional path. Path may be omitted (root append), a single
first-level key, or an array of literal segments for nested
append. See MergePath for the variant shape.
Remove
Remove a field
Implementations§
Source§impl UpdateOp
impl UpdateOp
Sourcepub fn set(path: impl Into<FieldPath>, value: impl Into<Option<Value>>) -> Self
pub fn set(path: impl Into<FieldPath>, value: impl Into<Option<Value>>) -> Self
Create a Set operation
Sourcepub fn append(path: impl Into<MergePath>, value: impl Into<Value>) -> Self
pub fn append(path: impl Into<MergePath>, value: impl Into<Value>) -> Self
Create an Append operation at a specific path. Accepts a single
first-level key ("foo") or any type that converts into
MergePath (e.g. Vec<String> for nested paths).
Sourcepub fn append_root(value: impl Into<Value>) -> Self
pub fn append_root(value: impl Into<Value>) -> Self
Create an Append operation at the root level (no path).
Sourcepub fn append_at_path<I, S>(segments: I, value: impl Into<Value>) -> Self
pub fn append_at_path<I, S>(segments: I, value: impl Into<Value>) -> Self
Create an Append operation at a nested path of literal segments.
Convenience wrapper for append(vec!["a", "b"], v).
Sourcepub fn merge_at(path: impl Into<MergePath>, value: impl Into<Value>) -> Self
pub fn merge_at(path: impl Into<MergePath>, value: impl Into<Value>) -> Self
Create a Merge operation at a specific path. Accepts a single
first-level key ("foo") or any type that converts into
MergePath (e.g. Vec<String> for nested paths).
Sourcepub fn merge_at_path<I, S>(segments: I, value: impl Into<Value>) -> Self
pub fn merge_at_path<I, S>(segments: I, value: impl Into<Value>) -> Self
Create a Merge operation at a nested path of literal segments.
Convenience wrapper for merge_at(vec!["a", "b"], v).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UpdateOp
impl<'de> Deserialize<'de> for UpdateOp
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for UpdateOp
impl JsonSchema for UpdateOp
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more