Documentation
¶
Index ¶
- Constants
- Variables
- func Delete[T any](ctx context.Context, t *Table, k Keys) error
- func Get[T any](ctx context.Context, t *Table, k Keys) (*T, error)
- func GetPut[T Keys](ctx context.Context, t *Table, item *T, mutator func(*T) error, maxRetries int) error
- func ListWithPrefix[T any](ctx context.Context, t Queryable, k Keys) ([]T, error)
- func Put[T Keys](ctx context.Context, t *Table, item *T) error
- func PutTx(ctx context.Context, t *Table, items ...Keys) error
- type Key
- type KeyName
- type KeySet
- type KeyValues
- type Keys
- type Queryable
- type Table
- func (t *Table) Client() *dynamodb.Client
- func (t *Table) IndexName() KeyName
- func (t *Table) Pk() string
- func (t *Table) PrefixPkValues(prefix string)
- func (t *Table) Sk() string
- func (t *Table) TableName() string
- func (t *Table) WithIndex(indexName KeyName, pk, sk string) Queryable
- func (t *Table) WithSimilarTable(tableName string) *Table
- type Version
Constants ¶
const DynamodbMaxTxItems = 25
Variables ¶
var ErrAlreadyExists = errors.New("already exists")
var ErrNotFound = errors.New("not found")
var ErrNotSupportNoSk = errors.New("not supported, no sk on table")
Functions ¶
func GetPut ¶ added in v0.2.5
func GetPut[T Keys](ctx context.Context, t *Table, item *T, mutator func(*T) error, maxRetries int) error
GetPut reads an item, applies mutator to the freshly-read copy, and writes it back. If the put fails because of a version constraint (another writer updated the item between the Get and Put), GetPut re-reads the item and retries, up to maxRetries attempts.
Warning: mutator may be called multiple times — once per attempt — so it must be safe to re-run against a freshly-read copy each time. If mutator returns a non-nil error, GetPut aborts immediately without retrying.
func ListWithPrefix ¶
Types ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}