Skip to content

Instantly share code, notes, and snippets.

@yairzaslavsky
Created August 18, 2020 18:51
Show Gist options
  • Save yairzaslavsky/8cc4e87ff83425b492522d2bcdb70f04 to your computer and use it in GitHub Desktop.
Save yairzaslavsky/8cc4e87ff83425b492522d2bcdb70f04 to your computer and use it in GitHub Desktop.
Person2.kt
/**
* DDB Enhanced client mapper annotations can be applied only to methods.
* This is why we cannot use a data class here.
*/
@DynamoDbBean
class Person(personId: String, name: String, familyName: String) {
@get:DynamoDbPartitionKey
var personId = personId;
@get:DynamoDbSecondaryPartitionKey(indexNames = ["familyName-index"])
var familyName: String = "",
@get:DynamoDbAttribute(value = "createTime")
var createTime: Long = java.time.Instant.now().epochSecond
@get:DynamoDbAttribute(value = "updateTime")
var updateTime: Long = java.time.Instant.now().epochSecond
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment