dynamodbstore

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dynamodbstore implements idempotency.Store on Amazon DynamoDB.

The table needs a string partition key named "id". Enable DynamoDB TTL on the "expiration" attribute so expired records are removed. The attribute names match Powertools for AWS Lambda, so an existing Powertools idempotency table can be reused.

Each record also stores the creating invocation's token in "lk_token", so a slow invocation cannot overwrite or delete a record another invocation took over.

The Lambda role needs dynamodb:PutItem, dynamodb:GetItem and dynamodb:DeleteItem on the table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	PutItem(ctx context.Context, in *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
	GetItem(ctx context.Context, in *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	DeleteItem(ctx context.Context, in *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
}

API is the subset of the DynamoDB client the store uses. *dynamodb.Client satisfies it.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an idempotency.Store backed by a DynamoDB table.

func New

func New(client API, table string) *Store

New returns a Store that saves records in the given table.

func (*Store) Create

func (s *Store) Create(ctx context.Context, r idempotency.Record, now time.Time) error

Create implements idempotency.Store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, r idempotency.Record) error

Delete implements idempotency.Store.

func (*Store) Update

func (s *Store) Update(ctx context.Context, r idempotency.Record) error

Update implements idempotency.Store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL