Documentation
¶
Overview ¶
Package typed provides additive generic wrappers around the stable TableTheory core interfaces. The wrappers keep the existing runtime behavior while moving common result/destination shapes into Go's type system at call sites.
Index ¶
- type Key
- type Model
- func (m Model[T]) BatchGet(keys []Key[T]) ([]T, error)
- func (m Model[T]) Create(item *T) error
- func (m Model[T]) CreateOrUpdate(item *T) error
- func (m Model[T]) Delete(item *T) error
- func (m Model[T]) DeleteKey(key Key[T]) error
- func (m Model[T]) Get(key Key[T]) (T, error)
- func (m Model[T]) GetOrNil(key Key[T]) (*T, error)
- func (m Model[T]) Item(item *T) Query[T]
- func (m Model[T]) Key(partitionKey any, sortKey ...any) Key[T]
- func (m Model[T]) Query() Query[T]
- func (m Model[T]) Update(item *T, fields ...string) error
- type Query
- func (q Query[T]) All() ([]T, error)
- func (q Query[T]) Between(field string, lo any, hi any) Query[T]
- func (q Query[T]) Count() (int64, error)
- func (q Query[T]) Create() error
- func (q Query[T]) CreateOrUpdate() error
- func (q Query[T]) Delete() error
- func (q Query[T]) Filter(field string, op query.Operator, value any) Query[T]
- func (q Query[T]) First() (T, error)
- func (q Query[T]) FirstOrNil() (*T, error)
- func (q Query[T]) Index(indexName string) Query[T]
- func (q Query[T]) Limit(limit int) Query[T]
- func (q Query[T]) Untyped() core.Query
- func (q Query[T]) Update(fields ...string) error
- func (q Query[T]) Where(field string, op query.Operator, value any) Query[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key[T any] struct { // contains filtered or unexported fields }
Key is a primary-key value tied to a specific model type.
type Model ¶
type Model[T any] struct { // contains filtered or unexported fields }
Model is a generic handle for one TableTheory model type.
func (Model[T]) CreateOrUpdate ¶
CreateOrUpdate upserts item using the existing TableTheory create-or-update semantics.
func (Model[T]) GetOrNil ¶
GetOrNil fetches one item by typed key and returns nil when it is absent.
func (Model[T]) Item ¶
Item returns a generic query builder bound to item for create/update/delete operations.
type Query ¶
type Query[T any] struct { // contains filtered or unexported fields }
Query is a generic query builder for a TableTheory model type.
func (Query[T]) CreateOrUpdate ¶
CreateOrUpdate upserts the query's bound item.
func (Query[T]) FirstOrNil ¶
FirstOrNil returns the first matching item or nil when it is absent.
func (Query[T]) Untyped ¶
Untyped exposes the underlying core.Query for compatibility with APIs not yet wrapped by the generic layer.