v0.1.0
First public release on crates.io. dynamodb-facade is a typed facade over aws-sdk-dynamodb that replaces string-spliced expressions, hand-built key maps, pagination loops, and 25-item batch chunking with composable, compile-time-checked Rust.
Added
- Expression builders, not strings.
Condition::eq,Condition::exists,Condition::begins_with,Condition::between,Condition::is_in,Condition::size_cmp, variadicCondition::and/Condition::or, combined with&,|,!.Update::set,Update::remove,Update::increment,Update::decrement,Update::init_increment,Update::init_decrement,Update::set_custom(withUpdateSetRhs),Update::list_append,Update::list_prepend,Update::add,Update::delete,Update::and,Update::combine,Update::try_combine.KeyCondition::pk(...)with.sk_eq,.sk_begins_with,.sk_between,.sk_lt/.sk_le/.sk_gt/.sk_ge. Every#name/:valueplaceholder is managed internally. - Zero-sized schema types.
attribute_definitions!,table_definitions!andindex_definitions!declarative macros generate marker types encoding the table / index key shape. Simple-key and composite-key tables and indexes are both supported. Using a sort-key method on a simple-key schema is a compile error. - Typed items via
dynamodb_item!. Wires a user struct to a table with constant or variable PK / SK, a type discriminator attribute, marker-only attributes (e.g. GSI partition keys that serde already serialises), and delegation of key construction to another type.has_attributes!macro for hand-rolledDynamoDBItemimplementations. - Typestate operation builders.
get,put,delete,update,query,scanand their_by_id/ instance variants. Three orthogonal typestate dimensions: output format (Typed↔Raw), return value (ReturnNothing↔Return<Old>↔Return<New>), and expression-set state (NoCondition/NoFilter/NoProjection↔AlreadyHas*). Calling.condition(),.filter()or.project()twice is a compile error..exists()/.not_exists()shorthands derived from the item's PK..raw()escape hatch to an untypedItem<TD>. - Single-table friendly. First-class support for the mono-table pattern (PK + SK + type discriminator).
Item<TD>::attribute::<ItemType>()for runtime dispatch on scan/query results,T::from_item/T::try_from_itemfor typed reconstruction,Item::into_key_only/Item::minimal_from/Item::with_attributes/Item::extract_key/Item::from_key_and_attributesfor key-level manipulation. - Automatic pagination.
.all()collects all pages into aVec,.stream()yields animpl Stream<Item = Result<T>>(orItem<TD>in Raw mode). NoExclusiveStartKeybookkeeping. Works on both query and scan.query_all/query_all_indexfor types with a constant partition key. - Index queries.
T::query_index::<Idx>(client, key_cond)andT::index_key_condition::<Idx>(id)for typed index queries,QueryRequest::new_index::<Idx>(...)for raw-level index queries when the entity type does not match the index's primary attribute. - Automatic batch chunking and retry.
dynamodb_batch_writesplitsVec<WriteRequest>into 25-item batches, runs them in parallel, and retriesUnprocessedItemswith backoff (up to 5 attempts).T::batch_put,T::batch_delete,T::batch_delete_by_id, and the freebatch_deletehelper produce the individual requests. Mixed put + delete batches supported. - Typed transactions.
T::transact_put,T::transact_delete,T::transact_update/transact_update_by_id,T::transact_conditionandT::transact_delete_by_idbuild aTransactWriteItemwith the same condition DSL as stand-alone operations, then.build()plugs into the SDK'stransact_write_items()fluent builder. - Flexible serialisation. Items round-trip through
serde_dynamoby default;DynamoDBItem<TD>can be hand-implemented when serde is not a good fit (e.g. enum stored as a single attribute). TheTDtable parameter is generic, so a single struct may implementDynamoDBItemfor multiple tables (useful for migrations). - Typed values.
IntoAttributeValuetrait for domain newtypes, with implementations for the standard scalar types,AsSet<T>for DynamoDB set types (SS/NS/BS),AsNumber<T>for numeric-flavoured attributes. - Unified error type.
Errorenum withDynamoDB,Serde,FailedBatchWrite,Other,Customvariants and aResult<T>alias.Error::as_dynamodb_error()downcasts for matching specific SDK errors (e.g.ConditionalCheckFailedException).Error::custom/Error::otherconstructors. - Escape hatch preserved. Every builder exposes
.into_inner()returning the underlyingaws_sdk_dynamodbfluent builder. The crate re-exportsaws_sdk_dynamodb::{Client, Error as DynamoDBError, types::AttributeValue}so downstream code does not need to pin the SDK version separately. - MSRV 1.85.0, edition 2024.
tokio/futures-based async, identical runtime assumptions toaws-sdk-dynamodbitself. - Feature flags.
test-fixturesexposes the sharedPlatformTable/User/Enrollment/TypeIndex/EmailIndexdomain types used in doc examples.integrationgates the Docker-backed end-to-end test suite against DynamoDB Local. - Documentation. Full API documentation on docs.rs, a
README.mdwith a side-by-side raw-SDK-vs-facade comparison, andEXAMPLES.md— a 13-section tour across a single-table domain covering schema design, every CRUD variant, index queries, scans with dispatch, the full condition and update DSL, batch writes, and transactions.