pub struct UpdateOps { /* private fields */ }Expand description
A builder-style helper struct for Space::update, Space::upsert,
Index::update, Index::upsert methods.
Start by calling the new function, then chain as many operations as
needed (add, assign, insert, etc.) after that you can either
pass the resulting expression directly into one of the supported methods,
or use the data directly after calling encode or into_inner.
§Examples
use tarantool::space::{Space, UpdateOps};
let mut space = Space::find("employee").unwrap();
space.update(
&[1337],
UpdateOps::new()
.add("strikes", 1).unwrap()
.assign("days-since-last-mistake", 0).unwrap(),
)
.unwrap();Implementations§
Source§impl UpdateOps
impl UpdateOps
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn assign<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn assign<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Assignment operation.
Corresponds to tarantool’s {'=', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn insert<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn insert<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Insertion operation.
Corresponds to tarantool’s {'!', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn add<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn add<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Numeric addition operation.
Corresponds to tarantool’s {'+', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn sub<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn sub<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Numeric subtraction operation.
Corresponds to tarantool’s {'-', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn and<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn and<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Bitwise AND operation.
Corresponds to tarantool’s {'&', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn or<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn or<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Bitwise OR operation.
Corresponds to tarantool’s {'|', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn xor<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
pub fn xor<K, V>(&mut self, field: K, value: V) -> Result<&mut Self>
Bitwise XOR operation.
Corresponds to tarantool’s {'^', field, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn delete<K>(&mut self, field: K, count: usize) -> Result<&mut Self>where
K: Serialize,
pub fn delete<K>(&mut self, field: K, count: usize) -> Result<&mut Self>where
K: Serialize,
Deletion operation.
Corresponds to tarantool’s {'#', field, count}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).
Sourcepub fn splice<K>(
&mut self,
field: K,
start: isize,
count: usize,
value: &str,
) -> Result<&mut Self>where
K: Serialize,
pub fn splice<K>(
&mut self,
field: K,
start: isize,
count: usize,
value: &str,
) -> Result<&mut Self>where
K: Serialize,
String splicing operation.
Corresponds to tarantool’s {':', field, start, count, value}.
Field indexing is zero based (first field has index 0). Negative indexes are offset from array’s end (last field has index -1).