Skip to content

Implement UpdateItem operation and support for TransactWriteItems #21

@shidil

Description

@shidil

Implement UpdateItem operation to update specified fields on a DynamoDB record.
This operation should accept a variadic options argument for customizing behavior (example:s WithConditionalUpdate, WithOptimisticLock)

Key requirements

  1. Allow updating keys with provided values (automatic update expression compute)
  2. Support write conditions https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html#DDB-UpdateItem-request-ConditionalOperator
  3. Support for optimistic lock via version attribute
  4. Support field update expressions (example: update field based on existing value add balance 100)
    https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html
type UpdateOption func(*dynamodb.UpdateItemInput) error

func UpdateItem(ctx context.Context, pk, sk Atrribute, fields interface{}, opt ...UpdateOption) 

Changes to TransactWriteItems

TransactWriteItems should support UpdateItem input.
Implement WithUpdateItem option for TransactWriteItems.
https://github.com/oolio-group/dynago/blob/main/transaction_items.go

func (t *Client) WithUpdateItem(pk string, sk string, fields interface{}) types.TransactUpdateItem {
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions