dynamo

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dynamo implements store.Store on a single DynamoDB table (hash key "pk", range key "sk", TTL attribute "expireAt"). The caller constructs and owns the *dynamodb.Client, so credentials, region, and endpoint (production or DynamoDB-local) stay a deployment concern.

TTL caveat: DynamoDB deletes expired items lazily, so expired records can remain visible for a time. Services already tolerate this (per the store.Record contract); windowed keys (RATE#.../HOUR#13) carry the exact semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements store.Store on one DynamoDB table.

func New

func New(client *dynamodb.Client, table string) *Store

New returns a Store over the given table.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, r store.Record, cond store.Cond) error

Delete removes the record at r.Key subject to cond.

func (*Store) Get

func (s *Store) Get(ctx context.Context, k store.Key) (store.Record, error)

Get returns the record at k, or store.ErrNotFound.

func (*Store) Increment

func (s *Store) Increment(ctx context.Context, k store.Key, delta int64, expireAt time.Time) (int64, error)

Increment atomically adds delta to the counter at k.

func (*Store) Put

func (s *Store) Put(ctx context.Context, r store.Record, cond store.Cond) (store.Record, error)

Put writes r subject to cond via an atomic UpdateItem that increments the stored version.

func (*Store) Query

func (s *Store) Query(ctx context.Context, pk, skPrefix string, opt store.QueryOpt) iter.Seq2[store.Record, error]

Query yields the partition's records in SK order, paginating internally.

Jump to

Keyboard shortcuts

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