Versions in this module Expand all Collapse all v0 v0.1.0 Sep 30, 2026 Changes in this version + const AttrCreated + const AttrPK + const AttrRev + const AttrSK + const AttrType + const AttrUpdated + const AttrVer + const MigrateUsage + const RangeEnd + const TimeLayout + var DefaultRetries = RetryPolicy + var ErrConflict = errors.New("dynago: concurrent modification") + var ErrContention = errors.New("dynago: transaction conflict") + var ErrExists = errors.New("dynago: already exists") + var ErrFieldRequired = errors.New("dynago: required field is empty") + var ErrInvalidCursor = errors.New("dynago: invalid cursor") + var ErrInvalidKey = errors.New("dynago: invalid key") + var ErrLeaseLost = errors.New("dynago: another migration job holds the lease") + var ErrLimit = errors.New("dynago: counter limit reached") + var ErrLimitRequired = errors.New("dynago: limit required") + var ErrMigrationConflict = errors.New("dynago: item can't be copied") + var ErrNeedsRead = errors.New("dynago: write must read the item first") + var ErrNotFound = errors.New("dynago: not found") + var ErrPrecondition = errors.New("dynago: precondition failed") + var ErrSameItemTwice = errors.New("dynago: a transaction would touch the same item twice") + var ErrStale = errors.New("dynago: item changed since it was read") + var ErrTaken = errors.New("dynago: unique value already taken") + var ErrTooManyItems = errors.New("dynago: write touches more than 100 items") + var ErrUnchanged = errors.New("dynago: already copied at this revision") + var ErrVersionMismatch = errors.New("dynago: item changed since the version supplied") + var ErrVersionRequired = errors.New("dynago: this write requires the version that was read") + func CheckAbsent(t dynamo.Table, key Key, ttlAttr string) *dynamo.ConditionCheck + func CheckCounter(t dynamo.Table, key Key, values []Cond) *dynamo.ConditionCheck + func CheckKeyPart(field, value, separators string) error + func CheckRequirement(t dynamo.Table, r Requirement) *dynamo.ConditionCheck + func CondUpdate(u *dynamo.Update, c Cond) + func ConsumeRequirement(t dynamo.Table, r Requirement) *dynamo.Delete + func DeleteIfExists(ctx context.Context, t dynamo.Table, key Key, g Guard) error + func Distinct(s []string) []string + func EnsureTable(ctx context.Context, db *dynamo.DB, name string, spec TableSpec) error + func Expired(ttl, now int64) bool + func ExpiredItem(raw dynamo.Item, ttlAttr string) bool + func FmtBool(b bool) string + func FmtInt(i int64) string + func FmtStamp(t time.Time) string + func FmtString[S ~string](s S) string + func FmtTime(t time.Time) string + func FormatVersion(rev int64) string + func GetMany(ctx context.Context, t dynamo.Table, keys []Key, consistent bool, out any) error + func GetOne(ctx context.Context, t dynamo.Table, key Key, consistent bool, out any) (found bool, err error) + func GuardUpdate(u *dynamo.Update, g Guard, now int64) + func ItemRev(raw dynamo.Item) int64 + func ItemType(raw dynamo.Item) string + func KeepUnknown(raw dynamo.Item, known map[string]bool, item any) (dynamo.Item, error) + func Lower(s string) string + func MigratedFrom(raw dynamo.Item, src Key, srcRev int64) (same, other bool) + func MigrationItem(item any, src Key, srcRev int64) (dynamo.Item, error) + func NeedsRead(err error) bool + func NewRev() int64 + func NewStamp() string + func Now() int64 + func ParseMigrate(args []string, base string) (command, table string, workers, passes int, rate float64, err error) + func ParseStamp(s string) time.Time + func ParseVersion(s string) (int64, error) + func Path(attr string) string + func Ptr[T any](v T) *T + func Query(ctx context.Context, t dynamo.Table, spec QuerySpec, page Page, out any) (string, error) + func ReadIfNeeded(fn func(read bool) error) error + func RequireLimit(name string, l Limit) error + func Retry(ctx context.Context, fn func() error) error + func Run(ctx context.Context, db *dynamo.DB, ops []Op) error + func Scan(ctx context.Context, t dynamo.Table, spec ScanSpec, page Page, out any) (string, error) + func SetFields(u *dynamo.Update, sets []Set) + func SetRetries(p RetryPolicy) + func ShardPK(pk string, owner Key, shards int) string + func ShardPKs(pk string, shards int) []string + func SignCursors(key []byte, previous ...[]byte) + func StaleAs(versioned bool, err error) error + func UnixTTL(t time.Time) int64 + func UpdateFields(ctx context.Context, t dynamo.Table, key Key, sets []Set, when []Cond, g Guard, ...) (int64, error) + type Change struct + After []Derived + Before []Derived + Owner Key + type Claim = claimItem + type Cond struct + Attr string + Value any + Zero bool + type Derived struct + Amount int64 + Attr string + Created string + Item any + Key Key + Kind DerivedKind + Limit Limit + LimitErr error + LimitRequired bool + Min Limit + MinErr error + TakenErr error + Type string + func Unbounded(ds []Derived) []Derived + type DerivedKind int + const KindClaim + const KindCopy + const KindCounter + type GSISpec struct + Name string + NonKeyAttrs []string + PKAttr string + Projection string + SKAttr string + type Guard struct + ExpectRev int64 + NotFound error + TTLAttr string + type Key struct + PK string + SK string + func ItemKey(raw dynamo.Item) Key + func SourceOf(raw dynamo.Item) (Key, int64, error) + type Limit struct + Max int64 + Set bool + Unbounded bool + func Max(n int64) Limit + func Unlimited() Limit + type Migration struct + Check func() error + Copy func(ctx context.Context, raw dynamo.Item, fence Op) error + DB *dynamo.DB + From string + KeyOf func(raw dynamo.Item) (key Key, ok bool, err error) + LeaseFor time.Duration + MaxPasses int + Out io.Writer + Rate float64 + Remove func(ctx context.Context, raw dynamo.Item, fence Op) error + TTLAttr string + To string + Types map[string]bool + Workers int + func (m *Migration) Run(ctx context.Context, command string) error + type Op struct + func CheckOp(key Key, c *dynamo.ConditionCheck, condErr error) Op + func CreateOp(key Key, p *dynamo.Put, condErr error, rev int64) Op + func DeleteOp(key Key, d *dynamo.Delete, condErr error) Op + func Diff(t dynamo.Table, owner Key, before, after []Derived) ([]Op, error) + func DiffAll(t dynamo.Table, changes []Change) ([]Op, error) + func PutOp(key Key, p *dynamo.Put, condErr error) Op + func UpdateOp(key Key, u *dynamo.Update, condErr error) Op + type OpError struct + Err error + Key Key + func (e *OpError) Error() string + func (e *OpError) Unwrap() error + type Page struct + Cursor string + Size int + type QuerySpec struct + Consistent bool + Desc bool + From *string + Index string + MaxPage int + PK string + PKAttr string + PageSize int + Prefix string + Project []string + SKAttr string + Scope string + TTLAttr string + To *string + type Requirement struct + Key Key + Optional bool + TTLAttr string + When []Cond + type RetryPolicy struct + Attempts int + BaseDelay time.Duration + MaxDelay time.Duration + type ScanSpec struct + Consistent bool + MaxPage int + PageSize int + Scope string + TTLAttr string + Type string + type Set struct + Attr string + Remove bool + StringSet bool + Value any + type TableSpec struct + GSIs []GSISpec + TTLAttr string + func (s TableSpec) CreateTableInput(name string) *dynamodb.CreateTableInput + type Timestamps struct + Created time.Time + Updated time.Time + func StampsOf(raw dynamo.Item) Timestamps + type WriteOption func(*WriteOptions) + func From(entity any) WriteOption + func IfVersion(v string) WriteOption + func ReturnVersion(dst *string) WriteOption + type WriteOptions struct + From any + NewVersion *string + Version string + func ApplyOptions(opts []WriteOption) WriteOptions + func (o WriteOptions) ExpectedRev() (int64, error) + func (o WriteOptions) Written(rev int64)