vantage_aws/dynamodb/mod.rs
1//! DynamoDB persistence — incubating.
2//!
3//! Sibling to the AWS list-API surface in `crate::models`. That surface
4//! treats `AwsAccount` itself as a `TableSource` and folds operation
5//! metadata into the table name. DynamoDB items don't fit that mould:
6//! they have a typed `AttributeValue` representation, native key/filter
7//! expressions, and full CRUD semantics. So DynamoDB lives here as a
8//! standalone persistence — same crate, different `TableSource`.
9//!
10//! Layout mirrors `vantage-sql`'s per-backend modules: `types/` defines
11//! the type system, `condition.rs` the native condition DSL,
12//! `operation.rs` the typed operator extension trait, and `impls/`
13//! holds the trait implementations.
14//!
15//! ```no_run
16//! # use vantage_aws::AwsAccount;
17//! # use vantage_aws::dynamodb::DynamoDB;
18//! # async fn run() -> vantage_core::Result<()> {
19//! let aws = AwsAccount::from_default()?;
20//! let _db = DynamoDB::new(aws);
21//! # Ok(()) }
22//! ```
23
24pub mod condition;
25pub mod id;
26pub mod impls;
27pub mod operation;
28pub mod types;
29
30pub(crate) mod transport;
31pub(crate) mod wire;
32
33pub use condition::DynamoCondition;
34pub use id::DynamoId;
35pub use operation::DynamoOperation;
36pub use types::{AnyDynamoType, AttributeValue, DynamoType, DynamoTypeVariants};
37
38use crate::account::AwsAccount;
39
40/// DynamoDB data source. Cheap to clone — wraps the (already `Arc`-backed)
41/// `AwsAccount` for credentials and signing.
42#[derive(Clone, Debug)]
43pub struct DynamoDB {
44 aws: AwsAccount,
45}
46
47impl DynamoDB {
48 /// Build a DynamoDB handle on top of an existing `AwsAccount`.
49 pub fn new(aws: AwsAccount) -> Self {
50 Self { aws }
51 }
52
53 /// Borrow the underlying `AwsAccount` (for signing, region, etc.).
54 pub fn aws(&self) -> &AwsAccount {
55 &self.aws
56 }
57}