pub struct Expression {
pub condition_expression: Option<String>,
pub key_condition_expression: Option<String>,
pub update_expression: Option<String>,
pub filter_expression: Option<String>,
pub projection_expression: Option<String>,
pub expression_attribute_names: Option<HashMap<String, String>>,
pub expression_attribute_values: Option<HashMap<String, AttributeValue>>,
}Expand description
The data needed for various aws_sdk_dynamodb input types.
Use Builder (via Expression::builder) to create DynamoDB
condition, filter, projection, key condition, and update expressions.
You can use these methods to consume this and set up a DynamoDB operation. See their docs for examples.
See also the to_*_input_builder and to_*_fluent_builder methods for
populating aws_sdk_dynamodb types.
You can use the fields on this struct to manually populate an
aws_sdk_dynamodb input type, or you can use one of the many methods on
this to automatically build or populate one of those types.
Fields§
§condition_expression: Option<String>The string to use as a DynamoDB condition expression.
Be sure to also use .expression_attribute_names and
.expression_attribute_values.
key_condition_expression: Option<String>The string to use use as a DynamoDB key condition expression.
Be sure to also use .expression_attribute_names and
.expression_attribute_values.
update_expression: Option<String>The string to use as a DynamoDB update expression.
Be sure to also use .expression_attribute_names and
.expression_attribute_values.
filter_expression: Option<String>The string to use as a DynamoDB filter expression.
Be sure to also use .expression_attribute_names and
.expression_attribute_values.
projection_expression: Option<String>The string to use as a DynamoDB projection expression.
Be sure to also use .expression_attribute_names.
expression_attribute_names: Option<HashMap<String, String>>DynamoDB expression attribute names.
expression_attribute_values: Option<HashMap<String, AttributeValue>>DynamoDB expression attribute values.
Implementations§
Source§impl Expression
Methods related to PutItem operations.
impl Expression
Methods related to PutItem operations.
Sourcepub fn to_put_builder(self) -> PutBuilder
pub fn to_put_builder(self) -> PutBuilder
Uses this Expression to create a PutBuilder with the following set:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_put_item_input_builder(self) -> PutItemInputBuilder
pub fn to_put_item_input_builder(self) -> PutItemInputBuilder
Uses this Expression to set the following on a PutItemInputBuilder:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_put_item_fluent_builder(
self,
builder: PutItemFluentBuilder,
) -> PutItemFluentBuilder
pub fn to_put_item_fluent_builder( self, builder: PutItemFluentBuilder, ) -> PutItemFluentBuilder
Uses this Expression to set the following on a PutItemFluentBuilder
before returning it:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn put_item(self, client: &Client) -> PutItemFluentBuilder
pub fn put_item(self, client: &Client) -> PutItemFluentBuilder
Sets up a put_item using the provided Client and uses this Expression
to set the following on the PutItemFluentBuilder before returning it:
- Condition expression
- Expression attribute names
- Expression attribute values
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::{types::AttributeValue, Client};
use dynamodb_expression::{Expression, Path};
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let output = Expression::builder()
.with_condition("name".parse::<Path>()?.attribute_not_exists())
.build()
.put_item(&client)
.table_name("people")
.item("name", AttributeValue::S(String::from("Jill")))
.item("age", AttributeValue::N(40.to_string()))
.send()
.await?;Source§impl Expression
Methods related to GetItem operations.
impl Expression
Methods related to GetItem operations.
Sourcepub fn to_get_builder(self) -> GetBuilder
pub fn to_get_builder(self) -> GetBuilder
Uses this Expression to create a GetBuilder with the following set:
- Projection expression
- Expression attribute names
Sourcepub fn to_get_item_input_builder(self) -> GetItemInputBuilder
pub fn to_get_item_input_builder(self) -> GetItemInputBuilder
Uses this Expression to set the following on a GetItemInputBuilder:
- Projection expression
- Expression attribute names
Sourcepub fn to_get_item_fluent_builder(
self,
builder: GetItemFluentBuilder,
) -> GetItemFluentBuilder
pub fn to_get_item_fluent_builder( self, builder: GetItemFluentBuilder, ) -> GetItemFluentBuilder
Uses this Expression to set the following on a GetItemFluentBuilder
before returning it:
- Projection expression
- Expression attribute names
Sourcepub fn get_item(self, client: &Client) -> GetItemFluentBuilder
pub fn get_item(self, client: &Client) -> GetItemFluentBuilder
Sets up a get_item using the provided Client and uses this Expression
to set the following on the GetItemFluentBuilder before returning it:
- Projection expression
- Expression attribute names
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::{types::AttributeValue, Client};
use dynamodb_expression::Expression;
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let output = Expression::builder()
.with_projection(["name", "age"])
.build()
.get_item(&client)
.table_name("people")
.key("id", AttributeValue::N(42.to_string()))
.send()
.await?;Source§impl Expression
Methods related to UpdateItem operations.
impl Expression
Methods related to UpdateItem operations.
Sourcepub fn to_update_builder(self) -> UpdateBuilder
pub fn to_update_builder(self) -> UpdateBuilder
Uses this Expression to create an UpdateBuilder with the following set:
- Update expression
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_update_item_input_builder(self) -> UpdateItemInputBuilder
pub fn to_update_item_input_builder(self) -> UpdateItemInputBuilder
Uses this Expression to create an UpdateItemInputBuilder with the following set:
- Update expression
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_update_item_fluent_builder(
self,
builder: UpdateItemFluentBuilder,
) -> UpdateItemFluentBuilder
pub fn to_update_item_fluent_builder( self, builder: UpdateItemFluentBuilder, ) -> UpdateItemFluentBuilder
Uses this Expression to set the following on an UpdateItemFluentBuilder
before returning it:
- Update expression
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn update_item(self, client: &Client) -> UpdateItemFluentBuilder
pub fn update_item(self, client: &Client) -> UpdateItemFluentBuilder
Sets up an update_item using the provided Client and uses this Expression
to set the following on the UpdateItemFluentBuilder before returning it:
- Update expression
- Condition expression
- Expression attribute names
- Expression attribute values
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::{types::AttributeValue, Client};
use dynamodb_expression::{Expression, Num, Path};
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let age: Path = "age".parse()?;
let output = Expression::builder()
.with_condition(age.clone().equal(Num::new(40)))
.with_update(age.math().add(1))
.build()
.update_item(&client)
.table_name("people")
.key("name", AttributeValue::S(String::from("Jack")))
.send()
.await?;Source§impl Expression
Methods related to DeleteItem operations.
impl Expression
Methods related to DeleteItem operations.
Sourcepub fn to_delete_builder(self) -> DeleteBuilder
pub fn to_delete_builder(self) -> DeleteBuilder
Uses this Expression to create a DeleteBuilder with the following set:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_delete_item_input_builder(self) -> DeleteItemInputBuilder
pub fn to_delete_item_input_builder(self) -> DeleteItemInputBuilder
Uses this Expression to set the following on a DeleteItemInputBuilder:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_delete_item_fluent_builder(
self,
builder: DeleteItemFluentBuilder,
) -> DeleteItemFluentBuilder
pub fn to_delete_item_fluent_builder( self, builder: DeleteItemFluentBuilder, ) -> DeleteItemFluentBuilder
Uses this Expression to set the following on a DeleteItemFluentBuilder
before returning it:
- Condition expression
- Expression attribute names
- Expression attribute values
Sourcepub fn delete_item(self, client: &Client) -> DeleteItemFluentBuilder
pub fn delete_item(self, client: &Client) -> DeleteItemFluentBuilder
Sets up a delete_item using the provided Client and uses this Expression
to set the following on the DeleteItemFluentBuilder before returning it:
- Condition expression
- Expression attribute names
- Expression attribute values
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::{types::AttributeValue, Client};
use dynamodb_expression::{Expression, Num, Path};
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let output = Expression::builder()
.with_condition("age".parse::<Path>()?.less_than(Num::new(20)))
.build()
.delete_item(&client)
.table_name("people")
.key("name", AttributeValue::S(String::from("Jack")))
.send()
.await?;Source§impl Expression
Methods related to Query operations.
impl Expression
Methods related to Query operations.
Sourcepub fn to_query_input_builder(self) -> QueryInputBuilder
pub fn to_query_input_builder(self) -> QueryInputBuilder
Uses this Expression to create a QueryInputBuilder with the following set:
- Key condition expression
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_query_fluent_builder(
self,
builder: QueryFluentBuilder,
) -> QueryFluentBuilder
pub fn to_query_fluent_builder( self, builder: QueryFluentBuilder, ) -> QueryFluentBuilder
Uses this Expression to set the following on a QueryFluentBuilder
before returning it:
- Key condition expression
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
Sourcepub fn query(self, client: &Client) -> QueryFluentBuilder
pub fn query(self, client: &Client) -> QueryFluentBuilder
Sets up a query using the provided Client and uses this Expression
to set the following on the QueryFluentBuilder before returning it:
- Key condition expression
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::Client;
use dynamodb_expression::{Expression, Num, Path};
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let output = Expression::builder()
.with_filter(
"name"
.parse::<Path>()?
.attribute_exists()
.and("age".parse::<Path>()?.greater_than_or_equal(Num::new(25))),
)
.with_projection(["name", "age"])
.with_key_condition("id".parse::<Path>()?.key().equal(Num::new(42)))
.build()
.query(&client)
.table_name("people")
.send()
.await?;Source§impl Expression
Methods related to Scan operations.
impl Expression
Methods related to Scan operations.
Sourcepub fn to_scan_input_builder(self) -> ScanInputBuilder
pub fn to_scan_input_builder(self) -> ScanInputBuilder
Uses this Expression to create a ScanInputBuilder with the following set:
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
Sourcepub fn to_scan_fluent_builder(
self,
builder: ScanFluentBuilder,
) -> ScanFluentBuilder
pub fn to_scan_fluent_builder( self, builder: ScanFluentBuilder, ) -> ScanFluentBuilder
Uses this Expression to set the following on a ScanFluentBuilder
before returning it:
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
Sourcepub fn scan(self, client: &Client) -> ScanFluentBuilder
pub fn scan(self, client: &Client) -> ScanFluentBuilder
Sets up a scan using the provided Client and uses this Expression
to set the following on the ScanFluentBuilder before returning it:
- Filter expression
- Projection expression
- Expression attribute names
- Expression attribute values
§Example
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::Client;
use dynamodb_expression::{Expression, Num, Path};
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let output = Expression::builder()
.with_filter("age".parse::<Path>()?.greater_than_or_equal(Num::new(25)))
.with_projection(["name", "age"])
.build()
.scan(&client)
.table_name("people")
.send()
.await?;Source§impl Expression
impl Expression
Sourcepub fn to_keys_and_attributes_builder(self) -> KeysAndAttributesBuilder
pub fn to_keys_and_attributes_builder(self) -> KeysAndAttributesBuilder
Uses this Expression to create a KeysAndAttributesBuilder with the following set:
- Projection expression
- Expression attribute names
§Example
use std::collections::HashMap;
use aws_config::BehaviorVersion;
use aws_sdk_dynamodb::{types::AttributeValue, Client};
use dynamodb_expression::Expression;
let client = Client::new(&aws_config::load_defaults(BehaviorVersion::latest()).await);
let expression = Expression::builder()
.with_projection(["name", "age"])
.build();
let key = HashMap::from([("id".to_string(), AttributeValue::N(42.to_string()))]);
let output = client
.batch_get_item()
.request_items(
"leads",
expression
.clone()
.to_keys_and_attributes_builder()
.keys(key.clone())
.build()
.unwrap(),
)
.request_items(
"customers",
expression
.to_keys_and_attributes_builder()
.keys(key)
.build()
.unwrap(),
)
.send()
.await?;
Sourcepub fn to_condition_check_builder(self) -> ConditionCheckBuilder
pub fn to_condition_check_builder(self) -> ConditionCheckBuilder
Uses this Expression to create a ConditionCheckBuilder with the following set:
- Condition expression
- Expression attribute names
- Expression attribute values
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more