#dynamo-db #expression #aws-sdk

dynamodb-expression

Types to build DynamoDB filter, condition, or update expressions

18 releases

0.2.0-beta.9 Jan 26, 2024
0.2.0-beta.8 Jan 17, 2024
0.2.0-beta.3 Dec 19, 2023
0.2.0-beta.2 Nov 28, 2023
0.1.0 Aug 18, 2023

#1082 in Database interfaces

34 downloads per month

Apache-2.0

320KB
5.5K SLoC

dynamodb-expression

A Rust crate to help build DynamoDB condition, filter, key condition, and update expressions in a type-safe way, including using expression attribute names and expression attribute values.

Crates.io Docs.rs

An example showing a how to use this crate to perform a query:

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 query_output = Expression::builder()
    .with_filter(
        "name"
            .parse::<Path>()?
            .attribute_exists()
            .and("age".parse::<Path>()?.greater_than_or_equal(Num::new(2.5))),
    )
    .with_projection(["name", "age"])
    .with_key_condition("id".parse::<Path>()?.key().equal(Num::new(42)))
    .build()
    .query(&client)
    .table_name("people")
    .send()
    .await?;

For more, see the docs.

Dependencies

~15–22MB
~286K SLoC