Versions in this module Expand all Collapse all v0 v0.1.0 Nov 1, 2026 Changes in this version + const Added + const Deleted + const Detached + const Modified + const Unchanged + var ErrBadSchema = errors.New("ant: invalid schema") + var ErrConcurrency = errors.New("ant: row was changed or removed since it was loaded") + var ErrCursor = errors.New("ant: invalid cursor") + var ErrCycle = errors.New("ant: new entities depend on each other") + var ErrIncludeInEach = errors.New("ant: Each does not support Include") + var ErrIncludeInSubquery = errors.New("ant: subquery cannot use Include") + var ErrKeyChanged = errors.New("ant: primary key of a tracked entity was changed") + var ErrKeyType = errors.New("ant: key type does not match the primary key") + var ErrMultipleRows = errors.New("ant: query matched more than one row") + var ErrNilEntity = errors.New("ant: entity is nil") + var ErrNoAssignment = errors.New("ant: update has no assignments") + var ErrNoColumnType = errors.New("ant: no database type for field") + var ErrNoColumns = errors.New("ant: query selects no columns") + var ErrNoCondition = errors.New("ant: bulk write has no condition") + var ErrNoContext = errors.New("ant: type does not embed ant.Context") + var ErrNoForeignKey = errs.ErrNoForeignKey + var ErrNoKey = errors.New("ant: model has no primary key") + var ErrNoRows = errors.New("ant: no rows given") + var ErrNotColumn = errors.New("ant: field is a relation, not a column") + var ErrNotFound = errors.New("ant: not found") + var ErrNotImplemented = errs.ErrNotImplemented + var ErrNotInTx = errors.New("ant: not in a transaction") + var ErrNotManyToMany = errors.New("ant: relation is not many-to-many") + var ErrNotOpen = errors.New("ant: context is not open") + var ErrNotProbe = errors.New("ant: pointer is not a field of a probe from ant.Fields") + var ErrNotRelation = errors.New("ant: field is not a relation") + var ErrNotSoftDeleted = errors.New("ant: model has no DeletedAt field") + var ErrNotTracked = errors.New("ant: entity is not tracked") + var ErrReadOnly = errors.New("ant: model is read-only") + var ErrThenWithoutOrder = errors.New("ant: ThenBy needs a preceding OrderBy") + var ErrTxDone = errors.New("ant: transaction has ended") + var ErrTxType = errors.New("ant: Tx closure takes a different context type") + var ErrUnknownColumn = errors.New("ant: result column has no field") + var ErrUnsupported = errs.ErrUnsupported + var ErrWrongModel = errors.New("ant: field belongs to a model outside this query") + func Add[T any](h Handle, entity *T) error + func Attach[T any](h Handle, entity *T) error + func AvgOf[T any, V Number](ctx context.Context, q *Query[T], field *V) (float64, error) + func Begin[DB any](ctx context.Context, db *DB, options ...TxOption) (*DB, error) + func Clone[T any](entity *T) *T + func CurrentTx(h Handle) *sql.Tx + func Detach[T any](h Handle, entity *T) + func FailedSQL(err error) string + func Fields[T any]() *T + func GenerateKey[E, V any](b *ModelBuilder[E], field *V, fn func() V) + func IsCheckViolation(err error) bool + func IsDirty[T, V any](e *EntityEntry[T], field *V) bool + func IsForeignKeyViolation(err error) bool + func IsNotNullViolation(err error) bool + func IsRetryable(err error) bool + func IsUniqueViolation(err error) bool + func Link[T, R any](ctx context.Context, h Handle, owner *T, rel *[]R, targets ...*R) error + func MarkModified[T any](h Handle, entity *T) error + func MaxOf[T any, V Ordered](ctx context.Context, q *Query[T], field *V) (V, error) + func MinOf[T any, V Ordered](ctx context.Context, q *Query[T], field *V) (V, error) + func Observe[T any](h Handle, o Observer[T]) error + func OnPrimary(ctx context.Context) context.Context + func Open[DB any](ctx context.Context, d dialect.Dialect, dsn string, options ...Option) (*DB, error) + func Original[T, V any](e *EntityEntry[T], field *V) (V, error) + func Pluck[T, V any](ctx context.Context, q *Query[T], field *V) ([]V, error) + func Pointers[T any](values []T) []*T + func Remove[T any](h Handle, entity *T) error + func SQLState(err error) string + func SchemaOf[DB any](d dialect.Dialect) (*schema.Schema, error) + func Session[DB any](db *DB, options ...Option) *DB + func SumOf[T any, V Number](ctx context.Context, q *Query[T], field *V) (V, error) + func SyncLinks[T, R any](ctx context.Context, h Handle, owner *T, rel *[]R, targets ...*R) error + func TableOf[T any]() (schemaName, table string, err error) + func Toggle[T, R any](ctx context.Context, h Handle, owner *T, rel *[]R, targets ...*R) error + func TrackGraph[T any](h Handle, root *T, decide func(GraphNode) State) error + func Tracked[T any](h Handle) []*T + func Unlink[T, R any](ctx context.Context, h Handle, owner *T, rel *[]R, targets ...*R) error + func UseConn[DB any](db *DB, conn *sql.Conn) (*DB, error) + func UseTx[DB any](db *DB, tx *sql.Tx) (*DB, error) + func Watch(ctx context.Context) context.Context + func WithoutHooks(ctx context.Context) context.Context + func Wrap[DB any](d dialect.Dialect, pool *sql.DB, options ...Option) (*DB, error) + type Action = meta.Action + const Cascade + const NoAction + const Restrict + const SetNull + type AfterDeleter interface + AfterDelete func(ctx context.Context) error + type AfterIncluder interface + AfterInclude func(ctx context.Context) error + type AfterInserter interface + AfterInsert func(ctx context.Context) error + type AfterLoader interface + AfterLoad func(ctx context.Context) error + type AfterUpdater interface + AfterUpdate func(ctx context.Context) error + type Alert struct + Kind string + Message string + SQL string + type Assignment struct + func Dec[V Number](field *V, n V) Assignment + func Inc[V Number](field *V, n V) Assignment + func SetExpr[V any](field *V, value Expr[V]) Assignment + func Set[V any](field *V, v V) Assignment + type Base struct + CreatedAt time.Time + ID int64 + UpdatedAt time.Time + type BeforeDeleter interface + BeforeDelete func(ctx context.Context) error + type BeforeInserter interface + BeforeInsert func(ctx context.Context) error + type BeforeUpdater interface + BeforeUpdate func(ctx context.Context) error + type BulkRows struct + Columns []string + Rows [][]any + Schema string + Table string + func PrepareBulk[T any](h Handle, entities []*T) (*BulkRows, error) + type CaseExpr struct + func Case[V any]() CaseExpr[V] + func (c CaseExpr[V]) Else(value V) Expr[V] + func (c CaseExpr[V]) ElseExpr(value Expr[V]) Expr[V] + func (c CaseExpr[V]) End() Expr[sql.Null[V]] + func (c CaseExpr[V]) When(cond Cond, then V) CaseExpr[V] + func (c CaseExpr[V]) WhenExpr(cond Cond, then Expr[V]) CaseExpr[V] + type Change struct + Changed []string + Entity any + Model string + State State + type ColumnBuilder struct + func (c *ColumnBuilder) Collation(name string) *ColumnBuilder + func (c *ColumnBuilder) Comment(text string) *ColumnBuilder + func (c *ColumnBuilder) Default(expr string) *ColumnBuilder + func (c *ColumnBuilder) Enum(name string, values ...string) *ColumnBuilder + func (c *ColumnBuilder) Fixed(n int) *ColumnBuilder + func (c *ColumnBuilder) Generated(expr string) *ColumnBuilder + func (c *ColumnBuilder) Length(n int) *ColumnBuilder + func (c *ColumnBuilder) NotNull() *ColumnBuilder + func (c *ColumnBuilder) Nullable() *ColumnBuilder + func (c *ColumnBuilder) Precision(precision, scale int) *ColumnBuilder + func (c *ColumnBuilder) Sensitive() *ColumnBuilder + func (c *ColumnBuilder) Sequence(name string, options ...SequenceOption) *ColumnBuilder + func (c *ColumnBuilder) Type(sql string) *ColumnBuilder + func (c *ColumnBuilder) Unique(name ...string) *ColumnBuilder + type ConcurrencyError struct + Key any + Model string + func (e *ConcurrencyError) Error() string + func (e *ConcurrencyError) Unwrap() error + type Cond struct + func AllOf[V comparable](v V, fields ...*V) Cond + func And(conds ...Cond) Cond + func AnyOf[V comparable](v V, fields ...*V) Cond + func Between[V Ordered](field *V, low, high V) Cond + func EqCol[V comparable](a, b *V) Cond + func Eq[V comparable](field *V, v V) Cond + func Exists(q Selectable) Cond + func FailedCond(err error) Cond + func Future(field *time.Time) Cond + func Gt[V Ordered](field *V, v V) Cond + func Gte[V Ordered](field *V, v V) Cond + func HasNone[R any](rel *[]R, conds ...Cond) Cond + func HasOne[R any](rel **R, conds ...Cond) Cond + func Has[R any](rel *[]R, conds ...Cond) Cond + func ILike[V ~string](field *V, pattern V) Cond + func InSub[V any](field *V, sub Sub[V]) Cond + func InTuples(fields []FieldRef, tuples ...[]any) Cond + func In[V comparable](field *V, values ...V) Cond + func IsNotNull[V any](field *V) Cond + func IsNull[V any](field *V) Cond + func Like[V ~string](field *V, pattern V) Cond + func Lt[V Ordered](field *V, v V) Cond + func Lte[V Ordered](field *V, v V) Cond + func Ne[V comparable](field *V, v V) Cond + func NoneOf[V comparable](v V, fields ...*V) Cond + func Not(c Cond) Cond + func NotExists(q Selectable) Cond + func NotInSub[V any](field *V, sub Sub[V]) Cond + func NotIn[V comparable](field *V, values ...V) Cond + func Or(conds ...Cond) Cond + func Past(field *time.Time) Cond + func SQLCond(text string, args ...any) Cond + func Today(field *time.Time) Cond + type Conflict struct + func OnConflict[V any](field *V) *Conflict + func (c *Conflict) And(ref FieldRef) *Conflict + func (c *Conflict) DoNothing() *Conflict + func (c *Conflict) DoUpdate(fields ...FieldRef) *Conflict + func (c *Conflict) Set(assignments ...Assignment) *Conflict + type Context struct + func (c *Context) ClearTracked() + func (c *Context) Close() error + func (c *Context) Commit() error + func (c *Context) DB() *sql.DB + func (c *Context) DebugTracked() string + func (c *Context) Dialect() dialect.Dialect + func (c *Context) EnsureCreated(ctx context.Context) error + func (c *Context) EnsureDeleted(ctx context.Context) error + func (c *Context) HasChanges() bool + func (c *Context) Release(ctx context.Context, name string) error + func (c *Context) Rollback() error + func (c *Context) RollbackTo(ctx context.Context, name string) error + func (c *Context) SaveChanges(ctx context.Context) error + func (c *Context) Savepoint(ctx context.Context, name string) error + func (c *Context) Tx[DB any](ctx context.Context, f func(tx *DB) error, options ...TxOption) error + type CursorPage struct + Items []*T + Next string + type DeletedAt = meta.DeletedAt + type Diagnostics struct + Alert func(ctx context.Context, a Alert) + Budget time.Duration + RepeatLimit int + type Entity interface + Configure func(b *ModelBuilder[E]) + type EntityEntry struct + func Entry[T any](h Handle, entity *T) *EntityEntry[T] + func (e *EntityEntry[T]) Changed() []string + func (e *EntityEntry[T]) State() State + type Events struct + SaveFailed func(ctx context.Context, err error) + Saved func(ctx context.Context, changes []Change) + Saving func(ctx context.Context, changes []Change) + StateChanged func(model string, entity any, from, to State) + Tracked func(model string, entity any) + type Expr struct + func AvgRelated[R any, V Number](rel *[]R, field *V, conds ...Cond) Expr[sql.Null[float64]] + func Avg[V Number](field *V) Expr[float64] + func Coalesce[V any](field *V, fallback V) Expr[V] + func Col[V any](field *V) Expr[V] + func Collate[V ~string](field *V, collation string) Expr[V] + func Count() Expr[int64] + func CountDistinct[V any](field *V) Expr[int64] + func CountOf[V any](field *V) Expr[int64] + func CountRelated[R any](rel *[]R, conds ...Cond) Expr[int64] + func DatePart(field *time.Time, part string) Expr[float64] + func DenseRank() Expr[int64] + func FailedExpr[V any](err error) Expr[V] + func Func[R any](name string, args ...any) Expr[R] + func Lag[V any](field *V) Expr[sql.Null[V]] + func Lead[V any](field *V) Expr[sql.Null[V]] + func Length[V ~string](field *V) Expr[int] + func Lower[V ~string](field *V) Expr[V] + func MaxRelated[R any, V Ordered](rel *[]R, field *V, conds ...Cond) Expr[sql.Null[V]] + func Max[V Ordered](field *V) Expr[V] + func MinRelated[R any, V Ordered](rel *[]R, field *V, conds ...Cond) Expr[sql.Null[V]] + func Min[V Ordered](field *V) Expr[V] + func Rank() Expr[int64] + func RowNumber() Expr[int64] + func SQL[V any](text string, args ...any) Expr[V] + func SumRelated[R any, V Number](rel *[]R, field *V, conds ...Cond) Expr[V] + func Sum[V Number](field *V) Expr[V] + func Upper[V ~string](field *V) Expr[V] + func (e Expr[V]) Asc() Sort + func (e Expr[V]) Desc() Sort + func (e Expr[V]) Div(v V) Expr[V] + func (e Expr[V]) Eq(v V) Cond + func (e Expr[V]) EqExpr(other Expr[V]) Cond + func (e Expr[V]) Filter(conds ...Cond) Expr[V] + func (e Expr[V]) Gt(v V) Cond + func (e Expr[V]) GtExpr(other Expr[V]) Cond + func (e Expr[V]) Gte(v V) Cond + func (e Expr[V]) IsNotNull() Cond + func (e Expr[V]) IsNull() Cond + func (e Expr[V]) Lt(v V) Cond + func (e Expr[V]) LtExpr(other Expr[V]) Cond + func (e Expr[V]) Lte(v V) Cond + func (e Expr[V]) Minus(v V) Expr[V] + func (e Expr[V]) Ne(v V) Cond + func (e Expr[V]) Over(w Window) Expr[V] + func (e Expr[V]) Plus(v V) Expr[V] + func (e Expr[V]) Times(v V) Expr[V] + type FieldConvention struct + Column string + Name string + Type reflect.Type + func (f *FieldConvention) SetLength(n int) + func (f *FieldConvention) SetSensitive() + func (f *FieldConvention) SetType(sql string) + type FieldRef struct + func F[V any](field *V) FieldRef + type ForeignKeyBuilder struct + func (k *ForeignKeyBuilder) Name(name string) *ForeignKeyBuilder + func (k *ForeignKeyBuilder) NoIndex() *ForeignKeyBuilder + func (k *ForeignKeyBuilder) OnDelete(action Action) *ForeignKeyBuilder + func (k *ForeignKeyBuilder) OnUpdate(action Action) *ForeignKeyBuilder + func (k *ForeignKeyBuilder) References(fields ...FieldRef) *ForeignKeyBuilder + type Gob struct + V V + func (g *Gob[V]) Scan(src any) error + func (g Gob[V]) ColumnType(dialect string) string + func (g Gob[V]) Value() (driver.Value, error) + type GraphNode struct + Entity any + HasKey bool + Model string + Parent any + type Grouped struct + func Then[V any](g *Grouped, field *V) *Grouped + func (g *Grouped) Having(conds ...Cond) *Grouped + func (g *Grouped) Limit(limit int) *Grouped + func (g *Grouped) Offset(offset int) *Grouped + func (g *Grouped) Order(terms ...Sort) *Grouped + type Handle interface + type IndexBuilder struct + func (i *IndexBuilder) AndExpr(expr string) *IndexBuilder + func (i *IndexBuilder) And[V any](field *V) *IndexBuilder + func (i *IndexBuilder) Concurrently() *IndexBuilder + func (i *IndexBuilder) Desc() *IndexBuilder + func (i *IndexBuilder) Include[V any](field *V) *IndexBuilder + func (i *IndexBuilder) Name(name string) *IndexBuilder + func (i *IndexBuilder) Unique() *IndexBuilder + func (i *IndexBuilder) Using(method string) *IndexBuilder + func (i *IndexBuilder) Where(condition string) *IndexBuilder + type InsertOption func(*insertOptions) + func BatchSize(n int) InsertOption + func WithConflict(c *Conflict) InsertOption + type Interceptor = exec.Interceptor + type JSON struct + V V + func (j *JSON[V]) Scan(src any) error + func (j *JSON[V]) UnmarshalJSON(data []byte) error + func (j JSON[V]) ColumnType(dialect string) string + func (j JSON[V]) MarshalJSON() ([]byte, error) + func (j JSON[V]) Value() (driver.Value, error) + type Join2 struct + func JoinLateral[T, J any](q *Query[T], sub *Query[J], on ...Cond) *Join2[T, J] + func JoinSub[T, J any](q *Query[T], sub *Query[J], on ...Cond) *Join2[T, J] + func LeftJoinLateral[T, J any](q *Query[T], sub *Query[J], on ...Cond) *Join2[T, J] + func LeftJoinSub[T, J any](q *Query[T], sub *Query[J], on ...Cond) *Join2[T, J] + func (j *Join2[A, B]) Distinct() *Join2[A, B] + func (j *Join2[A, B]) GroupByExpr[V any](e Expr[V]) *Grouped + func (j *Join2[A, B]) GroupBy[V any](field *V) *Grouped + func (j *Join2[A, B]) JoinMany[C any](rel *[]C) *Join3[A, B, C] + func (j *Join2[A, B]) JoinOn[C any](on ...Cond) *Join3[A, B, C] + func (j *Join2[A, B]) Join[C any](rel **C) *Join3[A, B, C] + func (j *Join2[A, B]) LeftJoinMany[C any](rel *[]C) *Join3[A, B, C] + func (j *Join2[A, B]) LeftJoinOn[C any](on ...Cond) *Join3[A, B, C] + func (j *Join2[A, B]) LeftJoin[C any](rel **C) *Join3[A, B, C] + func (j *Join2[A, B]) Limit(limit int) *Join2[A, B] + func (j *Join2[A, B]) Offset(offset int) *Join2[A, B] + func (j *Join2[A, B]) Order(terms ...Sort) *Join2[A, B] + func (j *Join2[A, B]) OrderByDesc[V Ordered](field *V) *Join2[A, B] + func (j *Join2[A, B]) OrderBy[V Ordered](field *V) *Join2[A, B] + func (j *Join2[A, B]) Select[R any](f func(*A, *B) R) *Projection[R] + func (j *Join2[A, B]) Where(c ...Cond) *Join2[A, B] + type Join3 struct + func (j *Join3[A, B, C]) Distinct() *Join3[A, B, C] + func (j *Join3[A, B, C]) GroupByExpr[V any](e Expr[V]) *Grouped + func (j *Join3[A, B, C]) GroupBy[V any](field *V) *Grouped + func (j *Join3[A, B, C]) JoinMany[D any](rel *[]D) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) JoinOn[D any](on ...Cond) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) Join[D any](rel **D) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) LeftJoinMany[D any](rel *[]D) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) LeftJoinOn[D any](on ...Cond) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) LeftJoin[D any](rel **D) *Join4[A, B, C, D] + func (j *Join3[A, B, C]) Limit(limit int) *Join3[A, B, C] + func (j *Join3[A, B, C]) Offset(offset int) *Join3[A, B, C] + func (j *Join3[A, B, C]) Order(terms ...Sort) *Join3[A, B, C] + func (j *Join3[A, B, C]) OrderByDesc[V Ordered](field *V) *Join3[A, B, C] + func (j *Join3[A, B, C]) OrderBy[V Ordered](field *V) *Join3[A, B, C] + func (j *Join3[A, B, C]) Select[R any](f func(*A, *B, *C) R) *Projection[R] + func (j *Join3[A, B, C]) Where(c ...Cond) *Join3[A, B, C] + type Join4 struct + func (j *Join4[A, B, C, D]) Distinct() *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) GroupByExpr[V any](e Expr[V]) *Grouped + func (j *Join4[A, B, C, D]) GroupBy[V any](field *V) *Grouped + func (j *Join4[A, B, C, D]) Limit(limit int) *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) Offset(offset int) *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) Order(terms ...Sort) *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) OrderByDesc[V Ordered](field *V) *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) OrderBy[V Ordered](field *V) *Join4[A, B, C, D] + func (j *Join4[A, B, C, D]) Select[R any](f func(*A, *B, *C, *D) R) *Projection[R] + func (j *Join4[A, B, C, D]) Where(c ...Cond) *Join4[A, B, C, D] + type KeyBuilder struct + func (k *KeyBuilder) NotGenerated() *KeyBuilder + type LogOption func(*logging) + func LogValues() LogOption + func SlowThreshold(d time.Duration) LogOption + type Mapping struct + func IntoExpr[V any](dst *V, src Expr[V]) Mapping + func Into[V any](dst *V, src *V) Mapping + type Merger struct + func Merge[T, S any](t *Table[T], source *Query[S], on ...Cond) *Merger[T] + func (m *Merger[T]) Delete() *Merger[T] + func (m *Merger[T]) Exec(ctx context.Context) (int64, error) + func (m *Merger[T]) WhenMatched(set ...Assignment) *Merger[T] + func (m *Merger[T]) WhenMatchedIf(c Cond, set ...Assignment) *Merger[T] + func (m *Merger[T]) WhenNotMatched(insert ...Mapping) *Merger[T] + type Mixin struct + func (m *Mixin) Check(name, expr string) + func (m *Mixin) Eq(column string, value any) Cond + func (m *Mixin) Filter(name string, filter func(context.Context) Cond) + func (m *Mixin) Index(columns ...string) *IndexBuilder + func (m *Mixin) Table() string + type MixinConfigurer interface + ConfigureMixin func(m *Mixin) + type ModelBuilder struct + func (b *ModelBuilder[E]) BelongsTo[R any](rel **R) *RelationBuilder + func (b *ModelBuilder[E]) Check(name, expr string) + func (b *ModelBuilder[E]) Column[V any](field *V) *ColumnBuilder + func (b *ModelBuilder[E]) Comment(text string) + func (b *ModelBuilder[E]) Comparer[V any](field *V, equal func(a, b V) bool) + func (b *ModelBuilder[E]) CompositeKey(fields ...FieldRef) + func (b *ModelBuilder[E]) Discriminator[V comparable](field *V, value V) + func (b *ModelBuilder[E]) ExcludeFromMigrations() + func (b *ModelBuilder[E]) Filter(name string, filter func(context.Context) Cond) + func (b *ModelBuilder[E]) ForeignKey(fields ...FieldRef) *ForeignKeyBuilder + func (b *ModelBuilder[E]) HasManyThrough[R, A, C any](rel *[]R, parentKey *A, throughKey *C) *RelationBuilder + func (b *ModelBuilder[E]) HasMany[R any](rel *[]R) *RelationBuilder + func (b *ModelBuilder[E]) HasOneThrough[R, A, C any](rel **R, parentKey *A, throughKey *C) *RelationBuilder + func (b *ModelBuilder[E]) HasOne[R any](rel **R) *RelationBuilder + func (b *ModelBuilder[E]) IndexExpr(expr string) *IndexBuilder + func (b *ModelBuilder[E]) Index[V any](field *V) *IndexBuilder + func (b *ModelBuilder[E]) KeyName(name string) + func (b *ModelBuilder[E]) Key[V any](field *V) *KeyBuilder + func (b *ModelBuilder[E]) ManyToMany[R any](rel *[]R) *RelationBuilder + func (b *ModelBuilder[E]) NoKey() + func (b *ModelBuilder[E]) NoTimestamps() + func (b *ModelBuilder[E]) PartitionByHash(fields ...FieldRef) + func (b *ModelBuilder[E]) PartitionByList(fields ...FieldRef) + func (b *ModelBuilder[E]) PartitionByRange(fields ...FieldRef) + func (b *ModelBuilder[E]) Schema(name string) + func (b *ModelBuilder[E]) Table(name string) + func (b *ModelBuilder[E]) Validate[V any](field *V, rule func(V) error) + func (b *ModelBuilder[E]) View(name string) + type ModelConvention struct + func (m *ModelConvention) Fields() []*FieldConvention + func (m *ModelConvention) Name() string + func (m *ModelConvention) SetTable(name string) + func (m *ModelConvention) Table() string + type Naming struct + Column func(goName string) string + Table func(goName string) string + type Number interface + type Observer struct + Deleted func(ctx context.Context, entity *T) + Inserted func(ctx context.Context, entity *T) + Updated func(ctx context.Context, entity *T) + type Option func(*settings) + func WithConvention(rule func(*ModelConvention)) Option + func WithDetailedErrors() Option + func WithDiagnostics(d Diagnostics) Option + func WithEvents(e Events) Option + func WithInterceptor(i Interceptor) Option + func WithLogger(logger *slog.Logger, options ...LogOption) Option + func WithLooseScan() Option + func WithNaming(naming Naming) Option + func WithNow(now func() time.Time) Option + func WithReplicas(pools ...*sql.DB) Option + func WithRetry(policy Retry) Option + func WithStickyWrites(d time.Duration) Option + func WithStrict() Option + func WithTracking(on bool) Option + func WithoutAutoTx() Option + type Ordered interface + type Outcome = exec.Outcome + type Page struct + Items []*T + Number int + Size int + Total int64 + func (p *Page[T]) HasNext() bool + func (p *Page[T]) Pages() int + type Projection struct + func Project[R any](q Selectable, mappings ...Mapping) *Projection[R] + func (p *Projection[R]) All(ctx context.Context) (out []R, err error) + func (p *Projection[R]) Each(ctx context.Context) iter.Seq2[R, error] + func (p *Projection[R]) First(ctx context.Context) (*R, error) + type Query struct + func FromFunc[T any](h Handle, call string, args ...any) *Query[T] + func FromRaw[T any](h Handle, text string, args ...any) *Query[T] + func RelatedOne[T, R any](h Handle, entity *T, rel **R) *Query[R] + func Related[T, R any](h Handle, entity *T, rel *[]R) *Query[R] + func Values[T any](h Handle, rows ...T) *Query[T] + func (q *Query[T]) After(ctx context.Context, cursor string, size int) (*CursorPage[T], error) + func (q *Query[T]) All(ctx context.Context) ([]*T, error) + func (q *Query[T]) Chunk(ctx context.Context, size int, f func([]*T) error) error + func (q *Query[T]) ChunkByKey(ctx context.Context, size int, f func([]*T) error) error + func (q *Query[T]) ClearOrder() *Query[T] + func (q *Query[T]) Column[V any](field *V) *Query[T] + func (q *Query[T]) Count(ctx context.Context) (int64, error) + func (q *Query[T]) CrossJoin[J any]() *Join2[T, J] + func (q *Query[T]) Debug() *Query[T] + func (q *Query[T]) Delete(ctx context.Context) (int64, error) + func (q *Query[T]) DeleteReturning(ctx context.Context) ([]*T, error) + func (q *Query[T]) DeleteSQL(ctx context.Context) (string, []any, error) + func (q *Query[T]) Distinct() *Query[T] + func (q *Query[T]) DoesNotExist(ctx context.Context) (bool, error) + func (q *Query[T]) Each(ctx context.Context) iter.Seq2[T, error] + func (q *Query[T]) Except(other *Query[T]) *Query[T] + func (q *Query[T]) Exists(ctx context.Context) (bool, error) + func (q *Query[T]) Explain(ctx context.Context) (string, error) + func (q *Query[T]) Find[K comparable](ctx context.Context, key K) (*T, error) + func (q *Query[T]) First(ctx context.Context) (*T, error) + func (q *Query[T]) ForShare() *Query[T] + func (q *Query[T]) ForUpdate() *Query[T] + func (q *Query[T]) ForceDelete(ctx context.Context) (int64, error) + func (q *Query[T]) From(sub *Query[T]) *Query[T] + func (q *Query[T]) FromCTE(name string, sub *Query[T]) *Query[T] + func (q *Query[T]) FullJoinOn[J any](on ...Cond) *Join2[T, J] + func (q *Query[T]) GroupByExpr[V any](e Expr[V]) *Grouped + func (q *Query[T]) GroupBy[V any](field *V) *Grouped + func (q *Query[T]) Hint(hint string) *Query[T] + func (q *Query[T]) IgnoreFilters(names ...string) *Query[T] + func (q *Query[T]) IncludeJoined[R any](rel **R) *Query[T] + func (q *Query[T]) IncludeOne[R any](rel **R, shape ...func(*Query[R]) *Query[R]) *Query[T] + func (q *Query[T]) Include[R any](rel *[]R, shape ...func(*Query[R]) *Query[R]) *Query[T] + func (q *Query[T]) Intersect(other *Query[T]) *Query[T] + func (q *Query[T]) JoinMany[J any](rel *[]J) *Join2[T, J] + func (q *Query[T]) JoinOn[J any](on ...Cond) *Join2[T, J] + func (q *Query[T]) JoinUsing[J, V any](field *V) *Join2[T, J] + func (q *Query[T]) Join[J any](rel **J) *Join2[T, J] + func (q *Query[T]) Latest(field *time.Time) *Query[T] + func (q *Query[T]) LeftJoinMany[J any](rel *[]J) *Join2[T, J] + func (q *Query[T]) LeftJoinOn[J any](on ...Cond) *Join2[T, J] + func (q *Query[T]) LeftJoin[J any](rel **J) *Join2[T, J] + func (q *Query[T]) Limit(n int) *Query[T] + func (q *Query[T]) NoTracking() *Query[T] + func (q *Query[T]) NoTrackingResolved() *Query[T] + func (q *Query[T]) NoWait() *Query[T] + func (q *Query[T]) Offset(n int) *Query[T] + func (q *Query[T]) Oldest(field *time.Time) *Query[T] + func (q *Query[T]) Omit[V any](field *V) *Query[T] + func (q *Query[T]) OnlyDeleted() *Query[T] + func (q *Query[T]) Order(terms ...Sort) *Query[T] + func (q *Query[T]) OrderByDesc[V Ordered](field *V) *Query[T] + func (q *Query[T]) OrderByRandom() *Query[T] + func (q *Query[T]) OrderBy[V Ordered](field *V) *Query[T] + func (q *Query[T]) Page(ctx context.Context, number, size int) (*Page[T], error) + func (q *Query[T]) Recursive(rel *[]T) *Query[T] + func (q *Query[T]) RecursiveOne(rel **T) *Query[T] + func (q *Query[T]) Restore(ctx context.Context) (int64, error) + func (q *Query[T]) RightJoinOn[J any](on ...Cond) *Join2[T, J] + func (q *Query[T]) Scope(scopes ...func(*Query[T]) *Query[T]) *Query[T] + func (q *Query[T]) Single(ctx context.Context) (*T, error) + func (q *Query[T]) SkipLocked() *Query[T] + func (q *Query[T]) Tag(name string) *Query[T] + func (q *Query[T]) ThenByDesc[V Ordered](field *V) *Query[T] + func (q *Query[T]) ThenBy[V Ordered](field *V) *Query[T] + func (q *Query[T]) ToSQL() (string, []any, error) + func (q *Query[T]) ToSQLContext(ctx context.Context) (string, []any, error) + func (q *Query[T]) Unfiltered() *Query[T] + func (q *Query[T]) Union(other *Query[T]) *Query[T] + func (q *Query[T]) UnionAll(other *Query[T]) *Query[T] + func (q *Query[T]) Update(ctx context.Context, a ...Assignment) (int64, error) + func (q *Query[T]) UpdateReturning(ctx context.Context, a ...Assignment) ([]*T, error) + func (q *Query[T]) UpdateSQL(ctx context.Context, set ...Assignment) (string, []any, error) + func (q *Query[T]) When(ok bool, f func(*Query[T]) *Query[T]) *Query[T] + func (q *Query[T]) Where(c ...Cond) *Query[T] + func (q *Query[T]) WithDeleted() *Query[T] + func (q *Query[T]) With[V any](field *V, value Expr[V]) *Query[T] + type RawQuery struct + func RawFile[T any](h Handle, fsys fs.FS, name string, args ...any) *RawQuery[T] + func Raw[T any](h Handle, query string, args ...any) *RawQuery[T] + func (r *RawQuery[T]) All(ctx context.Context) ([]T, error) + func (r *RawQuery[T]) Exec(ctx context.Context) (int64, error) + func (r *RawQuery[T]) First(ctx context.Context) (*T, error) + type RelationBuilder struct + func (r *RelationBuilder) ConstraintName(name string) *RelationBuilder + func (r *RelationBuilder) ForeignKey[V any](field *V) *RelationBuilder + func (r *RelationBuilder) Inverse[P any](back **P) *RelationBuilder + func (r *RelationBuilder) Latest[V Ordered](field *V) *RelationBuilder + func (r *RelationBuilder) Morph[V comparable](field *V, value V) *RelationBuilder + func (r *RelationBuilder) NoForeignKey() *RelationBuilder + func (r *RelationBuilder) NoIndex() *RelationBuilder + func (r *RelationBuilder) Oldest[V Ordered](field *V) *RelationBuilder + func (r *RelationBuilder) OnDelete(action Action) *RelationBuilder + func (r *RelationBuilder) OnUpdate(action Action) *RelationBuilder + func (r *RelationBuilder) PivotColumns(local, foreign string) *RelationBuilder + func (r *RelationBuilder) References[V any](field *V) *RelationBuilder + func (r *RelationBuilder) Through(table string) *RelationBuilder + func (r *RelationBuilder) Touch() *RelationBuilder + func (r *RelationBuilder) Where(conds ...Cond) *RelationBuilder + type Retry struct + Attempts int + type SaveInterceptor interface + SavingChanges func(ctx context.Context, changes []Change) error + type Selectable interface + type SequenceOption func(*meta.Sequence) + func IncrementBy(n int64) SequenceOption + func StartAt(n int64) SequenceOption + type Sort struct + func (s Sort) NullsFirst() Sort + func (s Sort) NullsLast() Sort + type State = track.State + type Statement = exec.Statement + func DryRun[DB any](ctx context.Context, db *DB, fn func(tx *DB) error) ([]Statement, error) + type Sub struct + func SubExpr[V any](q Selectable, value Expr[V]) Sub[V] + func SubOf[V any](q Selectable, field *V) Sub[V] + func (s Sub[V]) Expr() Expr[V] + type Table struct + func (t *Table[T]) All(ctx context.Context) ([]*T, error) + func (t *Table[T]) Column[V any](field *V) *Query[T] + func (t *Table[T]) Count(ctx context.Context) (int64, error) + func (t *Table[T]) CrossJoin[J any]() *Join2[T, J] + func (t *Table[T]) DeleteByID[K comparable](ctx context.Context, key K) error + func (t *Table[T]) Distinct() *Query[T] + func (t *Table[T]) Each(ctx context.Context) iter.Seq2[T, error] + func (t *Table[T]) Exists(ctx context.Context) (bool, error) + func (t *Table[T]) FindKey(ctx context.Context, parts ...any) (*T, error) + func (t *Table[T]) Find[K comparable](ctx context.Context, key K) (*T, error) + func (t *Table[T]) First(ctx context.Context) (*T, error) + func (t *Table[T]) FirstOrCreate(ctx context.Context, e *T, conds ...Cond) (*T, bool, error) + func (t *Table[T]) FirstOrNew(ctx context.Context, e *T, conds ...Cond) (*T, bool, error) + func (t *Table[T]) FullJoinOn[J any](on ...Cond) *Join2[T, J] + func (t *Table[T]) GroupByExpr[V any](e Expr[V]) *Grouped + func (t *Table[T]) GroupBy[V any](field *V) *Grouped + func (t *Table[T]) IgnoreFilters(names ...string) *Query[T] + func (t *Table[T]) IncludeJoined[R any](rel **R) *Query[T] + func (t *Table[T]) IncludeOne[R any](rel **R, shape ...func(*Query[R]) *Query[R]) *Query[T] + func (t *Table[T]) Include[R any](rel *[]R, shape ...func(*Query[R]) *Query[R]) *Query[T] + func (t *Table[T]) Insert(ctx context.Context, entities ...*T) error + func (t *Table[T]) InsertFrom(ctx context.Context, rows *Projection[T]) (int64, error) + func (t *Table[T]) InsertMany(ctx context.Context, entities []*T, options ...InsertOption) (int64, error) + func (t *Table[T]) InsertOnly(ctx context.Context, entities ...*T) error + func (t *Table[T]) JoinMany[J any](rel *[]J) *Join2[T, J] + func (t *Table[T]) JoinOn[J any](on ...Cond) *Join2[T, J] + func (t *Table[T]) Join[J any](rel **J) *Join2[T, J] + func (t *Table[T]) LeftJoinMany[J any](rel *[]J) *Join2[T, J] + func (t *Table[T]) LeftJoinOn[J any](on ...Cond) *Join2[T, J] + func (t *Table[T]) LeftJoin[J any](rel **J) *Join2[T, J] + func (t *Table[T]) Limit(n int) *Query[T] + func (t *Table[T]) LoadMissing[R any](ctx context.Context, rel *[]R, entities ...*T) error + func (t *Table[T]) LoadOne[R any](ctx context.Context, rel **R, entities ...*T) error + func (t *Table[T]) Load[R any](ctx context.Context, rel *[]R, entities ...*T) error + func (t *Table[T]) NoTracking() *Query[T] + func (t *Table[T]) Offset(n int) *Query[T] + func (t *Table[T]) Omit[V any](field *V) *Query[T] + func (t *Table[T]) OnlyDeleted() *Query[T] + func (t *Table[T]) Order(terms ...Sort) *Query[T] + func (t *Table[T]) OrderByDesc[V Ordered](field *V) *Query[T] + func (t *Table[T]) OrderBy[V Ordered](field *V) *Query[T] + func (t *Table[T]) Prune(ctx context.Context, conds ...Cond) (int64, error) + func (t *Table[T]) Query() *Query[T] + func (t *Table[T]) Reload(ctx context.Context, e *T) error + func (t *Table[T]) RightJoinOn[J any](on ...Cond) *Join2[T, J] + func (t *Table[T]) Scope(scopes ...func(*Query[T]) *Query[T]) *Query[T] + func (t *Table[T]) Single(ctx context.Context) (*T, error) + func (t *Table[T]) Truncate(ctx context.Context) error + func (t *Table[T]) Unfiltered() *Query[T] + func (t *Table[T]) UpdateMany(ctx context.Context, entities []*T, fields ...FieldRef) (int64, error) + func (t *Table[T]) Upsert(ctx context.Context, e *T, conflict *Conflict) (bool, error) + func (t *Table[T]) Where(c ...Cond) *Query[T] + func (t *Table[T]) WithDeleted() *Query[T] + func (t *Table[T]) With[V any](field *V, value Expr[V]) *Query[T] + type TxOption func(*txOptions) + func Attempts(n int) TxOption + func Isolation(level sql.IsolationLevel) TxOption + func ReadOnly() TxOption + type UnixTime = meta.UnixTime + type ValidationError struct + Err error + Field string + Model string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Validator interface + Validate func(ctx context.Context) error + type Window struct + func OrderedBy(terms ...Sort) Window + func PartitionBy[V any](field *V) Window + func (w Window) OrderBy(terms ...Sort) Window + func (w Window) PartitionBy(exprs ...exprNode) Window