Enum dynamodb_expression::update::Update
source · pub enum Update {
Set(Set),
Remove(Remove),
Add(Add),
Delete(Delete),
}
Expand description
Represents a DynamoDB update expression.
Examples
use dynamodb_expression::{
update::{Remove, Update},
Path,
};
let update = Update::from(Path::new_name("foo").math().add(7));
assert_eq!("SET foo = foo + 7", update.to_string());
let update = Update::from(Path::new_name("foo").if_not_exists().assign("a value"));
assert_eq!(
r#"SET foo = if_not_exists(foo, "a value")"#,
update.to_string()
);
let update = Update::from(Remove::new_name("foo"));
assert_eq!(r#"REMOVE foo"#, update.to_string());
let update = Update::from("foo[3].bar[0]".parse::<Path>().unwrap().remove());
assert_eq!(r#"REMOVE foo[3].bar[0]"#, update.to_string());
let update = Update::from(Remove::from_iter(
["foo", "bar", "baz"].into_iter().map(Path::new_name),
));
assert_eq!(r#"REMOVE foo, bar, baz"#, update.to_string());
Variants§
Implementations§
source§impl Update
impl Update
sourcepub fn new_set<T>(set: T) -> Selfwhere
T: Into<Set>,
pub fn new_set<T>(set: T) -> Selfwhere T: Into<Set>,
A new update expression for a Set
statement.
sourcepub fn new_remove<T>(remove: T) -> Selfwhere
T: Into<Remove>,
pub fn new_remove<T>(remove: T) -> Selfwhere T: Into<Remove>,
A new update expression for a Remove
statement.
sourcepub fn new_add<T>(add: T) -> Selfwhere
T: Into<Add>,
pub fn new_add<T>(add: T) -> Selfwhere T: Into<Add>,
A new update expression for an Add
statement.
sourcepub fn new_delete<T>(delete: T) -> Selfwhere
T: Into<Delete>,
pub fn new_delete<T>(delete: T) -> Selfwhere T: Into<Delete>,
A new update expression for a Delete
statement.
Trait Implementations§
source§impl From<IfNotExists> for Update
impl From<IfNotExists> for Update
source§fn from(value: IfNotExists) -> Self
fn from(value: IfNotExists) -> Self
Converts to this type from the input type.
source§impl From<ListAppend> for Update
impl From<ListAppend> for Update
source§fn from(value: ListAppend) -> Self
fn from(value: ListAppend) -> Self
Converts to this type from the input type.
source§impl PartialEq for Update
impl PartialEq for Update
impl Eq for Update
impl StructuralEq for Update
impl StructuralPartialEq for Update
Auto Trait Implementations§
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Creates a shared type from an unshared type.