Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparator ¶
type Comparator uint64
Comparator - enum for cursor pagination
const ( ComparatorEq Comparator = iota ComparatorNeq ComparatorLt ComparatorLte ComparatorGt ComparatorGte )
type Table ¶
type Table[M Model] interface { GetByID(ctx context.Context, id uint64) (M, error) Save(ctx context.Context, m M) error Update(ctx context.Context, m M) error List(ctx context.Context, limit, offset uint64, order SortOrder) ([]M, error) CursorList(ctx context.Context, id, limit uint64, order SortOrder, cmp Comparator) ([]M, error) LastID(ctx context.Context) (uint64, error) IsNoRows(err error) bool }
Table - interface to communication with one data type (like table, collection, etc)
type Transactable ¶
type Transactable interface {
BeginTransaction(ctx context.Context) (Transaction, error)
}
Transactable - interface which allows to begin atomic transaction operation
type Transaction ¶
type Transaction interface { Flush(ctx context.Context) error Add(ctx context.Context, model any) error Update(ctx context.Context, model any) error Rollback(ctx context.Context) error BulkSave(ctx context.Context, models []any) error Close(ctx context.Context) error HandleError(ctx context.Context, err error) error Exec(ctx context.Context, query string, params ...any) (int64, error) CopyFrom(ctx context.Context, tableName string, data []Copiable) error Tx() *bun.Tx }
Transaction - atomic transaction operation interface
Click to show internal directories.
Click to hide internal directories.