Struct dynamodb_expression::key::Key
source · pub struct Key { /* private fields */ }Expand description
Represents a DynamoDB key condition expression.
An instance can be constructed using the Path::key method, or the
the From<T: Into<Path>> implementation.
See also: Path::key
use dynamodb_expression::{key::Key, Path};
let key: Key = "foo".parse::<Path>()?.key();
let key: Key = "foo".parse::<Path>()?.into();Implementations§
source§impl Key
impl Key
sourcepub fn begins_with<T>(self, prefix: T) -> KeyConditionwhere
T: Into<StringOrRef>,
pub fn begins_with<T>(self, prefix: T) -> KeyConditionwhere
T: Into<StringOrRef>,
The DynamoDB begins_with function. True if the attribute specified by
the Path begins with a particular substring.
begins_with can take a string or a reference to an extended attribute
value. Here’s an example.
See also: Ref
use dynamodb_expression::{condition::BeginsWith, value::Ref, Path};
let key_condition = "foo".parse::<Path>()?.key().begins_with("T");
assert_eq!(r#"begins_with(foo, "T")"#, key_condition.to_string());
let key_condition = "foo".parse::<Path>()?.key().begins_with(Ref::new("prefix"));
assert_eq!(r#"begins_with(foo, :prefix)"#, key_condition.to_string());sourcepub fn between<L, U>(self, lower: L, upper: U) -> KeyCondition
pub fn between<L, U>(self, lower: L, upper: U) -> KeyCondition
The DynamoDB BETWEEN operator. True if self is greater than or
equal to lower, and less than or equal to upper.
See also: Path::between
use dynamodb_expression::{Num, Path};
let key_condition = "age"
.parse::<Path>()?
.key()
.between(Num::new(10), Num::new(90));
assert_eq!(r#"age BETWEEN 10 AND 90"#, key_condition.to_string());sourcepub fn equal<T>(self, right: T) -> KeyCondition
pub fn equal<T>(self, right: T) -> KeyCondition
A simple comparison that the specified attribute is equal to the provided value.
sourcepub fn greater_than<T>(self, right: T) -> KeyCondition
pub fn greater_than<T>(self, right: T) -> KeyCondition
A simple comparison that the specified attribute is greater than the provided value.
sourcepub fn greater_than_or_equal<T>(self, right: T) -> KeyCondition
pub fn greater_than_or_equal<T>(self, right: T) -> KeyCondition
A simple comparison that the specified attribute is greater than or equal to the provided value.
sourcepub fn less_than<T>(self, right: T) -> KeyCondition
pub fn less_than<T>(self, right: T) -> KeyCondition
A simple comparison that the specified attribute is less than the provided value.
sourcepub fn less_than_or_equal<T>(self, right: T) -> KeyCondition
pub fn less_than_or_equal<T>(self, right: T) -> KeyCondition
A simple comparison that the specified attribute is less than or equal to the provided value.
Trait Implementations§
source§impl Ord for Key
impl Ord for Key
source§impl PartialOrd for Key
impl PartialOrd for Key
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for Key
impl StructuralEq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.