{"id":35137111,"url":"https://github.com/raiden-rs/raiden-dynamo","last_synced_at":"2026-04-04T00:04:49.665Z","repository":{"id":37178330,"uuid":"256068962","full_name":"raiden-rs/raiden-dynamo","owner":"raiden-rs","description":"[WIP] ⚡️ DynamoDB library for Rust.","archived":false,"fork":false,"pushed_at":"2026-03-30T06:28:07.000Z","size":1006,"stargazers_count":39,"open_issues_count":27,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-30T08:33:57.703Z","etag":null,"topics":["aws","dynamodb","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raiden-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-16T00:30:14.000Z","updated_at":"2026-03-30T06:26:37.000Z","dependencies_parsed_at":"2023-02-12T00:16:40.838Z","dependency_job_id":"d6bf18fb-9a93-4d2a-9357-8b0c6fab13dd","html_url":"https://github.com/raiden-rs/raiden-dynamo","commit_stats":null,"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"purl":"pkg:github/raiden-rs/raiden-dynamo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raiden-rs%2Fraiden-dynamo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raiden-rs%2Fraiden-dynamo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raiden-rs%2Fraiden-dynamo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raiden-rs%2Fraiden-dynamo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raiden-rs","download_url":"https://codeload.github.com/raiden-rs/raiden-dynamo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raiden-rs%2Fraiden-dynamo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31382355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","dynamodb","rust"],"created_at":"2025-12-28T09:39:04.859Z","updated_at":"2026-04-04T00:04:49.657Z","avatar_url":"https://github.com/raiden-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src =\"https://github.com/bokuweb/raiden/blob/master/assets/logo.png?raw=true\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    DynamoDB library for Rust.\n\u003c/p\u003e\n\n---\n\n![Continuous Integration](https://github.com/bokuweb/raiden/workflows/Continuous%20Integration/badge.svg)\n\n## Examples\n\nYou can see more examples [here](https://github.com/raiden-rs/raiden-dynamo/tree/master/raiden/examples)\n\n### Generating client\n\n`raiden` uses `aws-sdk-dynamodb` or `rusoto_dynamodb` as internal client.\n\n#### With aws-sdk-dynamodb (`aws-sdk` is enabled)\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    // Simply, specify the region.\n    let client = User::client(config::Region::from_static(\"us-east-1\"));\n\n    // You can also specify aws-sdk-dynamodb client.\n    let client = {\n        let sdk_config = aws_config::defaults(aws_config::BehaviorVersion::latest())\n            .region(raiden::config::Region::from_static(\"us-east-1\"))\n            .load()\n            .await;\n        let sdk_client = raiden::Client::new(\u0026sdk_config);\n\n        User::client_with(sdk_client)\n    };\n\n    // Run operations...\n}\n```\n\n#### With rusoto_dynamodb ( `rusoto` or `rusoto_rustls` or `rustls` is enabled)\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    // Simply, specify the region.\n    let client = User::client(Region::UsEast1);\n\n    // You can also specify rusoto_core client.\n    let client = User::client_with(Client::shared(), Region::UsEast1);\n\n    // Run operations...\n}\n```\n\n#### Set prefix/suffix to the table name\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = User::client(config::Region::from_static(\"us-east-1\"))\n        .table_prefix(\"prefix-\")\n        .table_suffix(\"-suffix\");\n\n    // Print `prefix-user-suffix`\n    println!(\"{}\", client.table_name());\n}\n```\n\n#### Configure retry strategy\n\nNOTE: Default retry strategy differs between `aws-sdk` and `rusoto` ( or `rusoto_rustls` )\n\n- `aws-sdk` ... Not retry in raiden by default. Because you can configure retry strategy using `aws_config`. Or you can configure your own strategy like next example.\n- `rusoto` or `rusoto_rustls` ... Enabled retrying in raiden by default. See detail [here](https://github.com/mythrnr/raiden-dynamo/blob/master/raiden/src/retry/mod.rs).\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n// Force retry 3 times.\nstruct MyRetryStrategy;\n\nimpl RetryStrategy for MyRetryStrategy {\n    fn should_retry(\u0026self, _error: \u0026RaidenError) -\u003e bool {\n        true\n    }\n\n    fn policy(\u0026self) -\u003e Policy {\n        Policy::Limit(3)\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = User::client(config::Region::from_static(\"us-east-1\"))\n        .with_retries(Box::new(MyRetryStrategy));\n\n    // Run operations...\n}\n```\n\n### Running operations\n\n#### get_item\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n    let _res = client.get(\"user_primary_key\").run().await;\n}\n```\n\n#### put_item\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\npub struct User {\n    #[raiden(partition_key)]\n    id: String,\n    name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n    let input = User::put_item_builder()\n        .id(\"foo\".to_owned())\n        .name(\"bokuweb\".to_owned())\n        .build();\n    let _res = client.put(\u0026input).run().await;\n}\n```\n\n#### store maps and nested documents\n\n```rust\nuse std::collections::{BTreeMap, HashMap};\n\nuse raiden::*;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, RaidenDocument)]\nstruct Profile {\n    display_name: String,\n    level: usize,\n}\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    metadata: HashMap\u003cString, usize\u003e,\n    flags: BTreeMap\u003cString, bool\u003e,\n    profile: Profile,\n    profiles: HashMap\u003cString, Profile\u003e,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n\n    let mut metadata = HashMap::new();\n    metadata.insert(\"score\".to_owned(), 42);\n\n    let mut flags = BTreeMap::new();\n    flags.insert(\"active\".to_owned(), true);\n\n    let profile = Profile {\n        display_name: \"bokuweb\".to_owned(),\n        level: 3,\n    };\n\n    let mut profiles = HashMap::new();\n    profiles.insert(\"primary\".to_owned(), profile.clone());\n\n    let input = User::put_item_builder()\n        .id(\"user#1\".to_owned())\n        .metadata(metadata)\n        .flags(flags)\n        .profile(profile)\n        .profiles(profiles)\n        .build();\n\n    let _res = client.put(input).run().await;\n}\n```\n\nNotes:\n\n- map key is currently limited to `String`\n- use `#[derive(RaidenDocument)]` when you want to store a nested type directly as a field\n- `Document\u003cT\u003e` remains available as an explicit wrapper when you prefer opt-in at the field type level\n- empty maps are preserved as empty DynamoDB `M` values rather than being dropped\n\n#### query nested map and document values\n\n```rust\nuse std::collections::HashMap;\n\nuse raiden::*;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, RaidenDocument)]\nstruct Profile {\n    display_name: String,\n    level: usize,\n}\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    metadata: HashMap\u003cString, usize\u003e,\n    profile: Profile,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n\n    let key = User::key_condition(User::id()).eq(\"user#1\");\n\n    let filter = User::filter_expression(User::metadata().key(\"score\"))\n        .ge(40)\n        .and(User::filter_expression(User::profile().field(Profile::level())).eq(3));\n\n    let _res = client\n        .query()\n        .key_condition(key)\n        .filter(filter)\n        .run()\n        .await;\n\n    let condition = User::condition()\n        .attr_exists(User::metadata().key(\"score\"))\n        .and(User::condition().attr(User::profile().field(Profile::level())).eq_value(3));\n\n    // `condition` can be passed to `put`, `update`, `delete`,\n    // transaction writes, and other conditional operations.\n}\n```\n\nNotes:\n\n- use `.key(\"...\")` for dynamic map keys such as `metadata.score`\n- use `.field(...)` with `#[derive(RaidenDocument)]` accessors for nested document fields such as `profile.level`\n- document paths are supported in `filter_expression` and `condition`\n- `key_condition` still follows DynamoDB key rules, so nested map/document values are not valid partition or sort keys unless you project them to top-level attributes or an index\n- `.index(usize)` is also available when you need to address list elements in a document path\n- path segments are emitted through expression attribute names, so reserved words remain escaped correctly\n\n#### batch_get_item\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden, Debug, PartialEq)]\npub struct User {\n    #[raiden(partition_key)]\n    id: String,\n    #[raiden(sort_key)]\n    year: usize,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n    let keys: Vec\u003c(\u0026str, usize)\u003e = vec![(\"Alice\", 1992), (\"Bob\", 1976), (\"Charlie\", 2002)];\n    let res = client.batch_get(keys).run().await;\n}\n```\n\n#### query with typed GSI\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\n#[raiden(\n    gsi(\n        name = \"userIndex\",\n        partition_key = \"org_id\",\n        sort_key = \"created_at\",\n        sort_key = \"status\"\n    )\n)]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    org_id: String,\n    created_at: String,\n    status: String,\n    #[raiden(omit_gsi = \"userIndex\")]\n    internal_note: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n\n    let cond = UserIndexItem::user_index_key_condition()\n        .eq(\"org_1\")\n        .and(UserIndexItem::user_index_sort_key_condition_1().eq(\"2026-03-28T00:00:00Z\"))\n        .and(UserIndexItem::user_index_sort_key_condition_2().begins_with(\"active\"));\n\n    let _res = client\n        .query()\n        .user_index()\n        .project::\u003cUserIndexItem\u003e()\n        .key_condition(cond)\n        .run()\n        .await;\n\n    let _res = UserIndexItem::query(\u0026client)\n        .key_condition(cond)\n        .run()\n        .await;\n}\n```\n\nIf you want to override the generated projection shape or type name, declare a\n`RaidenIndex` explicitly:\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\n#[raiden(gsi(name = \"userIndex\", partition_key = \"org_id\"))]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    org_id: String,\n    display_name: String,\n    avatar_url: String,\n    #[raiden(omit_gsi = \"userIndex\")]\n    internal_note: String,\n}\n\n#[derive(RaidenIndex, Debug, PartialEq)]\n#[raiden(source = \"User\", gsi = \"userIndex\")]\n#[raiden(gsi(name = \"userIndex\", partition_key = \"org_id\"))]\nstruct PublicUserIndexItem {\n    org_id: String,\n    display_name: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n    let cond = PublicUserIndexItem::user_index_key_condition().eq(\"org_1\");\n\n    let _res = PublicUserIndexItem::query(\u0026client)\n        .key_condition(cond)\n        .run()\n        .await;\n}\n```\n\nComposite GSIs with multiple sort-key segments are also supported:\n\n```rust\nuse raiden::*;\n\n#[derive(Raiden)]\n#[raiden(table_name = \"user\")]\n#[raiden(\n    gsi(\n        name = \"activityIndex\",\n        partition_key = \"org_id\",\n        sort_key = \"created_at\",\n        sort_key = \"status\"\n    )\n)]\nstruct User {\n    #[raiden(partition_key)]\n    id: String,\n    org_id: String,\n    created_at: String,\n    status: String,\n    #[raiden(omit_gsi = \"activityIndex\")]\n    internal_note: String,\n}\n\n#[tokio::main]\nasync fn main() {\n    let client = /* generate client */;\n\n    let cond = UserActivityIndexItem::activity_index_key_condition()\n        .eq(\"org_1\")\n        .and(UserActivityIndexItem::activity_index_sort_key_condition_1().eq(\"2026-03-28T00:00:00Z\"))\n        .and(UserActivityIndexItem::activity_index_sort_key_condition_2().begins_with(\"active\"));\n\n    let _res = UserActivityIndexItem::query(\u0026client)\n        .key_condition(cond)\n        .run()\n        .await;\n}\n```\n\nThe composite helper methods enforce DynamoDB's ordering rules:\n\n- start with the partition key\n- then chain sort key segment 1, sort key segment 2, and so on\n- use range operators such as `gt`, `between`, and `begins_with` only on the last sort key segment\n\nNotes:\n\n- typed GSI methods such as `user_index()` are generated from `#[raiden(gsi = \"...\")]` or `#[raiden(gsi(...))]`\n- `#[raiden(omit_gsi = \"userIndex\")]` also generates a default projection type such as `UserIndexItem`, so the common case does not require writing `#[derive(RaidenIndex)]` manually\n- `#[derive(RaidenIndex)]` remains available when you want to override the generated projection shape or name, or when you prefer to declare the projection item explicitly\n- `#[derive(RaidenIndex)]` also generates `YourIndexType::query(\u0026client)` and `YourIndexType::scan(\u0026client)` helpers for projection-first access\n- add `#[raiden(gsi(name = \"...\", partition_key = \"...\", sort_key = \"...\"))]` to the `RaidenIndex` type when you also want typed key condition helpers on the projection type itself\n- typed GSI query/scan keeps the base struct projection by default; switch to an index projection explicitly with `project::\u003c...\u003e()`\n- `client.query().user_index().project::\u003cUserIndexItem\u003e()` and `UserIndexItem::query(\u0026client)` are equivalent entrypoints; choose whichever style is clearer for your call site\n- `client.scan().user_index().project::\u003cUserIndexItem\u003e()` and `UserIndexItem::scan(\u0026client)` are also equivalent entrypoints\n- `run_with::\u003c...\u003e()` remains available as a backward-compatible convenience wrapper\n- the legacy `.index(\"userIndex\")` API is still available for backward compatibility, and existing typed GSI builders still default to the source-item projection unless you opt into a projection item\n- composite GSI conditions must be chained in order: partition key -\u003e sort key 1 -\u003e sort key 2 ...\n- range conditions such as `gt`, `between`, and `begins_with` are only allowed on the last sort key\n- the old `.index(\"userIndex\")` API is deprecated, but preserved for compatibility while migrating to typed GSI helpers\n\n## Support `tokio-rs/tracing`\n\n`raiden` supports making span for Tracing ( span name is `dynamodb::action` with table name and api name in field ).  \nTo activate this feature, you need to specify `tracing` feature in your `Cargo.toml`. And your crate needs `tracing` .\n\n```toml\n# Example\n[dependencies]\nraiden = {\n    tag = \"0.0.76\",\n    git = \"https://github.com/raiden-rs/raiden-dynamo.git\",\n    features = [ \"tracing\"]\n}\ntracing = \"0.1\"\n```\n\n## Development\n\n### Requirements\n\n- Rust (1.76.0+)\n- Deno (1.13.2+)\n- GNU Make\n- Docker Engine\n\n### Run tests\n\n```\nmake test\n```\n\nNOTE: Don't recommend to use `cargo test` because our test suite doesn't support running tests in parallel. Use `cargo test -- --test-threads=1` instead of it.\n\n### Run examples\n\n```\nmake dynamo\n\nAWS_ACCESS_KEY_ID=dummy AWS_SECRET_ACCESS_KEY=dummy cargo run --example EXAMPLE_NAME\n```\n\n### Utility\n\n[dynamodb-admin](https://github.com/aaronshaf/dynamodb-admin) is useful to check data in DynamoDB Local.\n\n```\nnpx dynamodb-admin\n```\n\nThen open `http://localhost:8001` in browser.\n\n## Supported APIs\n\n### Item\n\n- [x] BatchGetItem\n- [ ] BatchWriteItem\n- [x] DeleteItem\n- [x] GetItem\n- [x] PutItem\n- [x] Query\n- [x] Scan\n- [ ] TransactGetItems\n- [x] TransactWriteItems\n- [x] UpdateItem\n\n## Known limitations\n\nHere is a list of unsupported features/behaviors in the actual implementation.\nWe have a plan to resolve these issues in a future release.\n\n- [x] Automatic retrying: https://github.com/raiden-rs/raiden/issues/44\n- [x] Strict type checking of keys: https://github.com/raiden-rs/raiden/issues/26\n- [x] Exponential backoff handling\n\n## License\n\nThis project is available under the terms of either the [Apache 2.0 license](./LICENSE-APACHE) or the [MIT license](./LICENSE-MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraiden-rs%2Fraiden-dynamo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraiden-rs%2Fraiden-dynamo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraiden-rs%2Fraiden-dynamo/lists"}