{"id":36626429,"url":"https://github.com/oharaandrew314/dynamodb-kotlin-module","last_synced_at":"2026-01-12T09:32:29.688Z","repository":{"id":49803094,"uuid":"421600664","full_name":"oharaandrew314/dynamodb-kotlin-module","owner":"oharaandrew314","description":"Kotlin Module for the dynamodb-enhanced SDk","archived":false,"fork":false,"pushed_at":"2024-07-12T18:05:19.000Z","size":149,"stargazers_count":23,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-07-13T19:43:36.211Z","etag":null,"topics":["aws","aws-sdk-java-v2","dynamodb","kotlin","mapper"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/oharaandrew314.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-10-26T22:20:37.000Z","updated_at":"2024-07-12T18:05:22.000Z","dependencies_parsed_at":"2024-07-12T19:38:41.197Z","dependency_job_id":null,"html_url":"https://github.com/oharaandrew314/dynamodb-kotlin-module","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/oharaandrew314/dynamodb-kotlin-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oharaandrew314%2Fdynamodb-kotlin-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oharaandrew314%2Fdynamodb-kotlin-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oharaandrew314%2Fdynamodb-kotlin-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oharaandrew314%2Fdynamodb-kotlin-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oharaandrew314","download_url":"https://codeload.github.com/oharaandrew314/dynamodb-kotlin-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oharaandrew314%2Fdynamodb-kotlin-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","aws-sdk-java-v2","dynamodb","kotlin","mapper"],"created_at":"2026-01-12T09:32:29.613Z","updated_at":"2026-01-12T09:32:29.682Z","avatar_url":"https://github.com/oharaandrew314.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/oharaandrew314/dynamodb-kotlin-module/branch/master/graph/badge.svg)](https://codecov.io/gh/oharaandrew314/dynamodb-kotlin-module)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Maven Central Version](https://img.shields.io/maven-central/v/dev.andrewohara/dynamokt)](https://central.sonatype.com/artifact/dev.andrewohara/dynamokt)\n\n# DynamoDb Kotlin Module\n\n\u003e **WARNING**\n\u003e During the move to Maven Central, the package prefix has changed from `io.andrewohara` to `dev.andrewohara`\n\nKotlin Module for the v2 dynamodb-enhanced SDK.\n\nAdapting an idiomatic kotlin data model for use with the v2 dynamodb mapper is a pain, and full of compromises;\ndata classes emulate a bean, which nullifies much of the advantages of data classes.\nThis module provides a new `TableSchema` implementation that adds support for kotlin data classes.\n\n- properties can be immutable; i.e. `val` is allowed\n- properties don't need default values\n- new annotations work directly on kotlin properties, rather than their getters\n\n## Requirements\n\nJava 11, 17, and 21 are officially supported.\n\n## Quickstart\n\n```kotlin\n// create a data class model, making sure to give it a partition key\ndata class Cat(\n    @DynamoKtPartitionKey val name: String,\n    val lives: Int = 9,\n)\n\n// use the new table schema provided by this module to init the table mapper\nval tableSchema = DataClassTableSchema(Cat::class)\nval cats = DynamoDbEnhancedClient.create().table(\"cats\", tableScema)\n\n// use the table mapper however you want!!\ncats.createTable()\ncats.putItem(Cat(\"Toggles\"))\n```\n\n## Annotations\n\nThe schema uses a new set of property-friendly annotations.\n\n```kotlin\ndata class Appointment(\n    @DynamoKtPartitionKey  // partition key for main index\n    @DynamoKtAttribute(name = \"owner_id\")  // optionally rename the attribute\n    val ownerId: UUID,\n    \n    @DynamoKtSortKey  // sort key for main index\n    val id: UUID,\n    \n    @DynamoKtSecondaryPartitionKey(indexNames = [\"names\"])  // partition key for secondary indices\n    val lastName: String,\n    \n    @DynamoKtSecondarySortKey(indexNames = [\"names\"])  // sort key for secondary indices\n    val firstName: String,\n    \n    @DynamoKtConverted(InstantAsLongAttributeConverter::class)  // override the attribute converter\n    val expires: Instant?,\n\n    @DynamoKtFlatten // flatten properties of annotated class with this document    \n    val metadata: Metadata\n)\n\n// If an instance of this type is empty, don't coerce it to null\n@DynamoKtPreserveEmptyObject\ndata class Metadata(val created: Instant?, val refereceNumber: Int?)\n```\n\n## Support for Extensions\n\nBean table extensions are supported.  Register the extension to the client like normal,\nand then add the `DynamoDbBean` extension annotation to the getter of the property.\n\n```kotlin\ndata class Post(\n    @DynamoKtPartitionKey\n    val id: UUID,\n    \n    val title: String,\n    \n    @get:DynamoDbVersionAttribute  // add extension annotation to the getter  (ie get:\u003cannotation\u003e)\n    val version: Int\n)\n```\n\n## Gotchas\n\nThe `DynamoDbAsyncClient.createTable` method does not create the indices your table definition might have defined.\nThis is unlike the `DynamoDbClient`, which, in recent versions of the AWS SDK, performs as you would expect.\n\nTo work around this, `DynamoKt` offers a `createTableWithIndices` extension method to provide the expected behaviour.\n\n## Samples\n\nSee the [Samples](/src/test/kotlin/dev/andrewohara/dynamokt/samples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foharaandrew314%2Fdynamodb-kotlin-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foharaandrew314%2Fdynamodb-kotlin-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foharaandrew314%2Fdynamodb-kotlin-module/lists"}