Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for flattening objects #28

Open
ansman opened this issue Jan 24, 2021 · 2 comments
Open

Support for flattening objects #28

ansman opened this issue Jan 24, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ansman
Copy link

ansman commented Jan 24, 2021

The official DynamoDB mapper (at least the 2.x one) has a DynamoDbFlatten that instructs it to flatten the specified property out into a single row:

@DynamoDbBean
data class BookItem(
  @get:DynamoDbPartitionKey
  var iban: String? 
  var name: String? = null,
  @get:DynamoDbFlatten
  var author: Author? = null
) {
  @get:DynamoDbSortKey
  var sortKey: String = "book"

  @DynamoDbBean
  data class Author(
    @get:DynamoDbAttribute("authorName")
    var name: String? = null,
    @get:DynamoDbAttribute("authorNationality")
    var nationality: String? = null
  )
}

It would be nice if Tempest provided either an automatic or manual mapping of these nested types.

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 26, 2021

Hmm I think your example is missing the @DynamoDbFlatten annotation?

@DynamoDbBean
data class BookItem(
  // ...
  @get:DynamoDbFlatten
  var author: Author? = null
) {
  // ...
}

@zhxnlai zhxnlai added the help wanted Extra attention is needed label Jan 26, 2021
@ansman
Copy link
Author

ansman commented Jan 26, 2021

Yeah, my bad. I've updated the example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants