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

Setting values in a map attribute #367

Open
arun-subramanian-1 opened this issue Oct 9, 2023 · 0 comments
Open

Setting values in a map attribute #367

arun-subramanian-1 opened this issue Oct 9, 2023 · 0 comments

Comments

@arun-subramanian-1
Copy link

arun-subramanian-1 commented Oct 9, 2023

Does this library support setting a single key in a map attribute ?

I want to set/update a single key in a map attribute, without fetching and saving the record back. Using below entity as an example is it possible to create an update request SET attribute.#flag = :value

@Entity({
  name: 'User',
  primaryKey: {
    partition key: '{{primaryKey}}',
  },
})
export class User {
  @Attribute()
  primaryKey: string // Primary key attribute

  @Attribute()
  name: string

  @Attribute()
  id: string

  @Attribute() // Define a map attribute
  attribute: Record<string, string>
}

I tried something like below but it doesn't work.

await this.entityManager.update(User, query, {
      attribute: {
        SET: {
          [flag]: status,
        },
      },
    })
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant