Documentation
¶
Overview ¶
Package orm declares typed tables without generated model adapters. For example: orders := Define("orders", func(b Builder[Order], o *Order) OrderTable { ... }).
Index ¶
- Constants
- Variables
- func Attach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) (P, error)
- func AttachMany[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func Audit[M any, K comparable](table Table[M, K], changes Changes[M], policy AuditPolicy[M]) (auditrecord.Model[M, K], error)
- func AuditRead[M, K, V any](history auditrecord.Model[M, K], field interface{ ... }) (value.Optional[auditrecord.FieldChange[V]], error)
- func AuditReadEncrypted[M, K any, V encrypted.Value[V]](history auditrecord.Model[M, K], field Encrypted[M, V]) (value.Optional[auditrecord.FieldChange[V]], error)
- func AuditReadNullable[M, K, V any](history auditrecord.Model[M, K], field interface{ ... }) (value.Optional[auditrecord.FieldChange[value.Nullable[V]]], error)
- func AuditReadNullableEncrypted[M, K any, V encrypted.Value[V]](history auditrecord.Model[M, K], field NullableEncrypted[M, V]) (value.Optional[auditrecord.FieldChange[value.Nullable[V]]], error)
- func Auditing[M any, K comparable](table Table[M, K], policy AuditPolicy[M]) auditrecord.Declaration
- func ChangeOf[M, V any](changes Changes[M], field interface{ ... }) (lifecycle.FieldChange[V], error)
- func Check(tables ...CheckedTable) error
- func ChunkByKey[M any, K comparable](ctx context.Context, ex database.Executor, q Query[M], key KeyColumn[M, K], ...) error
- func CreateEach[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) ([]M, error)
- func CreateOrFirst[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) (M, error)
- func Define[M any, T CheckedTable](name string, declare func(Builder[M], *M) T, opts ...Option) (result T)
- func Delete[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], key Key[M, K], ...) (M, error)
- func DeleteEach[M any](ctx context.Context, writer database.Transactor, q Query[M], limit int) ([]M, error)
- func Detach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func DetachAll[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func DetachMany[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func EachByKey[M any, K comparable](ctx context.Context, ex database.Executor, q Query[M], key KeyColumn[M, K], ...) error
- func EncryptedChangeOf[M any, V encrypted.Value[V]](changes Changes[M], field Encrypted[M, V]) (lifecycle.FieldChange[V], error)
- func FirstOrCreate[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) (M, error)
- func ForceDelete[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], ...) (M, error)
- func ForceDeleteEach[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) ([]M, error)
- func ForceDetach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func ForcePruneBatch[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) (int64, error)
- func FoundryCodec[V any](option ColumnOption[V], seal sqlowner.MetadataSeal) codec.Codec[V]
- func FoundryColumn[M, V, P any](column ExpressionColumn[M, V, P], seal sqlowner.MetadataSeal) (ormcore.Column[V], ormcore.Column[P])
- func FoundryConflictData[M any](policy Conflict[M], seal sqlowner.ExpressionSeal) ormcore.ConflictPolicy
- func FoundryLockedRecord[M any](q LockedQuery[M], seal sqlowner.MetadataSeal) ormcore.RecordSource
- func FoundryModel[M any](q Query[M], seal sqlowner.MetadataSeal) (ormcore.Source, func(database.Row) (M, error))
- func FoundryModelRead[M any](q Query[M], seal sqlowner.MetadataSeal) ormcore.RecordSource
- func FoundryPredicate[M any](p Predicate[M], seal sqlowner.MetadataSeal) ormcore.Predicate
- func FoundryRecord[M any](scope ormcore.Scope, seal sqlowner.MetadataSeal) ormcore.Record
- func FoundryRelatedValue[M, N, V any](source AggregateSource[M, N], expression ormcore.Expression, ...) ormcore.Expression
- func FoundrySlot[M any, K comparable, S any](key Key[M, K], slot Slot[M, S], seal sqlowner.MetadataSeal) (string, func(M) model.Reference[M, K], func(M) S, func(M, S) M, error)
- func FoundrySource[M any](q Query[M], seal sqlowner.MetadataSeal) ormcore.Source
- func InsertEach[M any, K comparable](ctx context.Context, writer database.Transactor, table Table[M, K], ...) ([]M, error)
- func LoadFrom[M any](ctx context.Context, ex database.Executor, q Query[M], parents []M) ([]M, error)
- func LoadMissingFrom[M any](ctx context.Context, ex database.Executor, q Query[M], parents []M) ([]M, error)
- func NullableChangeOf[M, V any](changes Changes[M], field interface{ ... }) (lifecycle.FieldChange[value.Nullable[V]], error)
- func NullableEncryptedChangeOf[M any, V encrypted.Value[V]](changes Changes[M], field NullableEncrypted[M, V]) (lifecycle.FieldChange[value.Nullable[V]], error)
- func NumberKey[M any, K interface{ ... }, R keyRole](key keyColumn[M, K, R]) numberKeyColumn[M, K, R]
- func PruneBatch[M any](ctx context.Context, writer database.Transactor, q Query[M], size int, ...) (int64, error)
- func RegisterObserver[M any](r *foundation.Registrar, pool foundation.Key[*database.DB], ...) error
- func RegisterRetrievalObserver[M any](r *foundation.Registrar, pool foundation.Key[*database.DB], ...) error
- func RestoreEach[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) ([]M, error)
- func TextKey[M any, K ~string, R keyRole](key keyColumn[M, K, R]) textColumn[M, K, R]
- func Update[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], key Key[M, K], ...) (M, error)
- func UpdateEach[M any](ctx context.Context, writer database.Transactor, q Query[M], limit int, ...) ([]M, error)
- func UpdateOrCreate[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) (M, error)
- func UpdatePivot[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) ([]P, error)
- func Upsert[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) (value.Optional[M], error)
- func UpsertMany[M any](ctx context.Context, writer database.Transactor, q Query[M], ...) ([]M, error)
- func WithoutRelationGlobalScope[M, N any, R scopeRelation[M, N, R]](r R, scopes ...GlobalScope[N]) R
- func WithoutRelationGlobalScopes[M, N any, R scopeRelation[M, N, R]](r R) R
- func WriteGet[M, I any](write *Write[M], setter func(I) Assignment[M]) value.Optional[I]
- func WriteIsSet[M, I any](write *Write[M], setter func(I) Assignment[M]) bool
- func WriteNullableGet[M, I any](write *Write[M], setter func(I) Assignment[M]) value.Optional[value.Nullable[I]]
- func WriteSet[M any](write *Write[M], assignments ...Assignment[M]) error
- func WriteUnset[M, I any](write *Write[M], setter func(I) Assignment[M]) error
- type AggregateRelation
- type AggregateSource
- type Assignment
- type AuditPolicy
- type AuditRule
- func AuditEncryptedField[M any, V encrypted.Value[V]](field Encrypted[M, V], disclosure auditrecord.Disclosure) AuditRule[M]
- func AuditField[M, V any](field interface{ ... }, disclosure auditrecord.Disclosure) AuditRule[M]
- func AuditNullableEncryptedField[M any, V encrypted.Value[V]](field NullableEncrypted[M, V], disclosure auditrecord.Disclosure) AuditRule[M]
- type BelongsTo
- func (r BelongsTo[M, N]) LatestOfMany() BelongsTo[M, N]
- func (r BelongsTo[M, N]) OfMany(orders ...Order[N]) BelongsTo[M, N]
- func (r BelongsTo[M, N]) OldestOfMany() BelongsTo[M, N]
- func (r BelongsTo[M, N]) OnlyTrashed() BelongsTo[M, N]
- func (r BelongsTo[M, N]) OrderBy(os ...Order[N]) BelongsTo[M, N]
- func (r BelongsTo[M, N]) Where(ps ...Predicate[N]) BelongsTo[M, N]
- func (r BelongsTo[M, N]) With(children ...Relation[N]) BelongsTo[M, N]
- func (r BelongsTo[M, N]) WithTrashed() BelongsTo[M, N]
- func (r BelongsTo[M, N]) WithoutTrashed() BelongsTo[M, N]
- type Bound
- type Builder
- type Changes
- func (c Changes[M]) After() value.Optional[M]
- func (c Changes[M]) Assigned() bool
- func (c Changes[M]) Before() value.Optional[M]
- func (c Changes[M]) Changed() bool
- func (Changes[M]) GoString() string
- func (c Changes[M]) Operation() value.Optional[lifecycle.Operation]
- func (Changes[M]) String() string
- type CheckedTable
- type Column
- func BoolOf[M any, V ~bool](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
- func BytesOf[M any, V ~[]byte](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
- func ColumnOf[M, V any](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
- func IDOf[M, T any](b Builder[M], ptr *model.ID[T]) Column[M, model.ID[T]]
- func PasswordOf[M any](b Builder[M], ptr *password.Hash) Column[M, password.Hash]
- func (c Column[M, V]) Asc() Order[M]
- func (c Column[M, V]) Desc() Order[M]
- func (c Column[M, V]) Eq(v V) Predicate[M]
- func (c Column[M, V]) In(v ...V) Predicate[M]
- func (c Column[M, V]) Ne(v V) Predicate[M]
- func (c Column[M, V]) NotIn(v ...V) Predicate[M]
- func (c Column[M, V]) Set(v V) Assignment[M]
- type ColumnOption
- type Conflict
- func (p Conflict[M]) DoNothing() Conflict[M]
- func (p Conflict[M]) DoUpdate(updates ...ConflictUpdate[M]) Conflict[M]
- func (Conflict[M]) GoString() string
- func (Conflict[M]) String() string
- func (p Conflict[M]) TargetWhere(predicates ...Predicate[M]) Conflict[M]
- func (p Conflict[M]) Where(predicates ...Predicate[M]) Conflict[M]
- type ConflictColumn
- type ConflictUpdate
- func ConflictIncoming[M, V any](field interface{ ... }) ConflictUpdate[M]
- func ConflictNull[M, V any](field ExpressionColumn[M, V, value.Nullable[V]]) ConflictUpdate[M]
- func ConflictSet[M, I, V any, F conflictAssignment[M, I, V]](field F, input I) ConflictUpdate[M]
- func FoundryConflictUpdate[M any](metadata ormcore.ConflictAssignment, seal sqlowner.ExpressionSeal) ConflictUpdate[M]
- type CreatedAt
- type Cursor
- type CursorInputError
- type CursorPage
- type CursorRequest
- type DeleteSource
- func (p DeleteSource[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
- func (DeleteSource[S, M]) Format(s fmt.State, _ rune)
- func (p DeleteSource[S, M]) Match(key SourceKey[S, M]) DeleteSource[S, M]
- func (p DeleteSource[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
- type DirectRelation
- type Encrypted
- type Enum
- type ExistenceRelation
- type ExpressionColumn
- type ExtensionRelation
- type GlobalScope
- type HasMany
- func HasManyOf[M, N any, K comparable](slot Many[M, N], local KeyColumn[M, K], foreign KeyColumn[N, K]) HasMany[M, N]
- func HasManyThroughOf[M, I, N any, A, B comparable](slot Many[M, N], local KeyColumn[M, A], first KeyColumn[I, A], ...) HasMany[M, N]
- func MorphManyOf[M model.Morphable, N any, K comparable](slot Many[M, N], local KeyColumn[M, K], id KeyColumn[N, K], ...) HasMany[M, N]
- func (r HasMany[M, N]) OnlyTrashed() HasMany[M, N]
- func (r HasMany[M, N]) OrderBy(os ...Order[N]) HasMany[M, N]
- func (r HasMany[M, N]) Where(ps ...Predicate[N]) HasMany[M, N]
- func (r HasMany[M, N]) With(children ...Relation[N]) HasMany[M, N]
- func (r HasMany[M, N]) WithTrashed() HasMany[M, N]
- func (r HasMany[M, N]) WithoutTrashed() HasMany[M, N]
- type HasOne
- func HasOneOf[M, N any, K comparable](slot One[M, N], local KeyColumn[M, K], foreign KeyColumn[N, K]) HasOne[M, N]
- func HasOneThroughOf[M, I, N any, A, B comparable](slot One[M, N], local KeyColumn[M, A], first KeyColumn[I, A], ...) HasOne[M, N]
- func MorphOneOf[M model.Morphable, N any, K comparable](slot One[M, N], local KeyColumn[M, K], id KeyColumn[N, K], ...) HasOne[M, N]
- func (r HasOne[M, N]) LatestOfMany() HasOne[M, N]
- func (r HasOne[M, N]) OfMany(orders ...Order[N]) HasOne[M, N]
- func (r HasOne[M, N]) OldestOfMany() HasOne[M, N]
- func (r HasOne[M, N]) OnlyTrashed() HasOne[M, N]
- func (r HasOne[M, N]) OrderBy(os ...Order[N]) HasOne[M, N]
- func (r HasOne[M, N]) Where(ps ...Predicate[N]) HasOne[M, N]
- func (r HasOne[M, N]) With(children ...Relation[N]) HasOne[M, N]
- func (r HasOne[M, N]) WithTrashed() HasOne[M, N]
- func (r HasOne[M, N]) WithoutTrashed() HasOne[M, N]
- type Hooks
- type InputColumn
- func (c InputColumn[M, I, V]) Asc() Order[M]
- func (c InputColumn[M, I, V]) Desc() Order[M]
- func (c InputColumn[M, I, V]) Eq(v V) Predicate[M]
- func (c InputColumn[M, I, V]) In(v ...V) Predicate[M]
- func (c InputColumn[M, I, V]) Ne(v V) Predicate[M]
- func (c InputColumn[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c InputColumn[M, I, V]) Set(v I) Assignment[M]
- type InputEnum
- func (c InputEnum[M, I, E]) Asc() Order[M]
- func (c InputEnum[M, I, E]) Desc() Order[M]
- func (c InputEnum[M, I, E]) Eq(v E) Predicate[M]
- func (c InputEnum[M, I, E]) In(v ...E) Predicate[M]
- func (c InputEnum[M, I, E]) Ne(v E) Predicate[M]
- func (c InputEnum[M, I, E]) NotIn(v ...E) Predicate[M]
- func (c InputEnum[M, I, E]) Set(v I) Assignment[M]
- type InputInterval
- func (c InputInterval[M, I]) Asc() Order[M]
- func (c InputInterval[M, I]) Between(a, b temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Desc() Order[M]
- func (c InputInterval[M, I]) Eq(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Gt(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Gte(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) In(v ...temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Lt(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Lte(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Ne(v temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) NotIn(v ...temporal.Interval) Predicate[M]
- func (c InputInterval[M, I]) Set(v I) Assignment[M]
- type InputJSON
- func (c InputJSON[M, I, T]) Asc() Order[M]
- func (c InputJSON[M, I, T]) ContainedBy(v value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) Contains(v value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) Desc() Order[M]
- func (c InputJSON[M, I, T]) Eq(v value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) In(v ...value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) IsJSONNull() Predicate[M]
- func (c InputJSON[M, I, T]) Ne(v value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) NotIn(v ...value.JSON[T]) Predicate[M]
- func (c InputJSON[M, I, T]) Set(v I) Assignment[M]
- type InputKey
- func (c InputKey[M, I, K]) Asc() Order[M]
- func (c InputKey[M, I, K]) Desc() Order[M]
- func (c InputKey[M, I, K]) Eq(v K) Predicate[M]
- func (c InputKey[M, I, K]) In(v ...K) Predicate[M]
- func (c InputKey[M, I, K]) Ne(v K) Predicate[M]
- func (c InputKey[M, I, K]) NotIn(v ...K) Predicate[M]
- func (c InputKey[M, I, K]) Set(v I) Assignment[M]
- type InputNumber
- func (c InputNumber[M, I, V]) Asc() Order[M]
- func (c InputNumber[M, I, V]) Between(a, b V) Predicate[M]
- func (c InputNumber[M, I, V]) Desc() Order[M]
- func (c InputNumber[M, I, V]) Eq(v V) Predicate[M]
- func (c InputNumber[M, I, V]) Gt(v V) Predicate[M]
- func (c InputNumber[M, I, V]) Gte(v V) Predicate[M]
- func (c InputNumber[M, I, V]) In(v ...V) Predicate[M]
- func (c InputNumber[M, I, V]) Lt(v V) Predicate[M]
- func (c InputNumber[M, I, V]) Lte(v V) Predicate[M]
- func (c InputNumber[M, I, V]) Ne(v V) Predicate[M]
- func (c InputNumber[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c InputNumber[M, I, V]) Set(v I) Assignment[M]
- type InputText
- func (c InputText[M, I, V]) Asc() Order[M]
- func (c InputText[M, I, V]) Between(a, b V) Predicate[M]
- func (c InputText[M, I, V]) Contains(v V) Predicate[M]
- func (c InputText[M, I, V]) Desc() Order[M]
- func (c InputText[M, I, V]) EndsWith(v V) Predicate[M]
- func (c InputText[M, I, V]) Eq(v V) Predicate[M]
- func (c InputText[M, I, V]) Gt(v V) Predicate[M]
- func (c InputText[M, I, V]) Gte(v V) Predicate[M]
- func (c InputText[M, I, V]) IContains(v V) Predicate[M]
- func (c InputText[M, I, V]) IEndsWith(v V) Predicate[M]
- func (c InputText[M, I, V]) ILike(v V) Predicate[M]
- func (c InputText[M, I, V]) IStartsWith(v V) Predicate[M]
- func (c InputText[M, I, V]) In(v ...V) Predicate[M]
- func (c InputText[M, I, V]) Like(v V) Predicate[M]
- func (c InputText[M, I, V]) Lt(v V) Predicate[M]
- func (c InputText[M, I, V]) Lte(v V) Predicate[M]
- func (c InputText[M, I, V]) Ne(v V) Predicate[M]
- func (c InputText[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c InputText[M, I, V]) Set(v I) Assignment[M]
- func (c InputText[M, I, V]) StartsWith(v V) Predicate[M]
- type InputTime
- func (c InputTime[M, I, V]) Asc() Order[M]
- func (c InputTime[M, I, V]) Between(a, b V) Predicate[M]
- func (c InputTime[M, I, V]) Desc() Order[M]
- func (c InputTime[M, I, V]) Eq(v V) Predicate[M]
- func (c InputTime[M, I, V]) Gt(v V) Predicate[M]
- func (c InputTime[M, I, V]) Gte(v V) Predicate[M]
- func (c InputTime[M, I, V]) In(v ...V) Predicate[M]
- func (c InputTime[M, I, V]) Lt(v V) Predicate[M]
- func (c InputTime[M, I, V]) Lte(v V) Predicate[M]
- func (c InputTime[M, I, V]) Ne(v V) Predicate[M]
- func (c InputTime[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c InputTime[M, I, V]) Set(v I) Assignment[M]
- type InsertMapping
- type InsertSelect
- func (p InsertSelect[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
- func (InsertSelect[S, M]) Format(s fmt.State, _ rune)
- func (p InsertSelect[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
- func (p InsertSelect[S, M]) Select(mappings ...InsertMapping[S, M]) InsertSelect[S, M]
- func (p InsertSelect[S, M]) Values(values ...Assignment[M]) InsertSelect[S, M]
- type InsertTarget
- type InstantValue
- type Interval
- func (c Interval[M]) Asc() Order[M]
- func (c Interval[M]) Between(a, b temporal.Interval) Predicate[M]
- func (c Interval[M]) Desc() Order[M]
- func (c Interval[M]) Eq(v temporal.Interval) Predicate[M]
- func (c Interval[M]) Gt(v temporal.Interval) Predicate[M]
- func (c Interval[M]) Gte(v temporal.Interval) Predicate[M]
- func (c Interval[M]) In(v ...temporal.Interval) Predicate[M]
- func (c Interval[M]) Lt(v temporal.Interval) Predicate[M]
- func (c Interval[M]) Lte(v temporal.Interval) Predicate[M]
- func (c Interval[M]) Ne(v temporal.Interval) Predicate[M]
- func (c Interval[M]) NotIn(v ...temporal.Interval) Predicate[M]
- func (c Interval[M]) Set(v temporal.Interval) Assignment[M]
- type JSON
- func (c JSON[M, T]) Asc() Order[M]
- func (c JSON[M, T]) ContainedBy(v value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) Contains(v value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) Desc() Order[M]
- func (c JSON[M, T]) Eq(v value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) In(v ...value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) IsJSONNull() Predicate[M]
- func (c JSON[M, T]) Ne(v value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) NotIn(v ...value.JSON[T]) Predicate[M]
- func (c JSON[M, T]) Set(v value.JSON[T]) Assignment[M]
- type Key
- type KeyColumn
- type KeyLookup
- type LockedQuery
- func (q LockedQuery[M]) All(ctx context.Context, tx *database.Tx) ([]M, error)
- func (q LockedQuery[M]) Each(ctx context.Context, tx *database.Tx, yield func(M) error) error
- func (q LockedQuery[M]) First(ctx context.Context, tx *database.Tx) (value.Optional[M], error)
- func (q LockedQuery[M]) Limit(n int) LockedQuery[M]
- func (q LockedQuery[M]) NoWait() LockedQuery[M]
- func (q LockedQuery[M]) Offset(n int) LockedQuery[M]
- func (q LockedQuery[M]) OnlyTrashed() LockedQuery[M]
- func (q LockedQuery[M]) OrderBy(os ...Order[M]) LockedQuery[M]
- func (q LockedQuery[M]) Require(ctx context.Context, tx *database.Tx) (M, error)
- func (q LockedQuery[M]) SkipLocked() LockedQuery[M]
- func (q LockedQuery[M]) Wait() LockedQuery[M]
- func (q LockedQuery[M]) Where(ps ...Predicate[M]) LockedQuery[M]
- func (q LockedQuery[M]) WithTrashed() LockedQuery[M]
- func (q LockedQuery[M]) WithoutTrashed() LockedQuery[M]
- type Many
- type ModelIdentity
- func (d ModelIdentity[M, K]) ActiveKeys(ctx context.Context, ex database.Executor, keys []K) ([]K, error)
- func (d ModelIdentity[M, K]) KeyToken(key K) (string, error)
- func (d ModelIdentity[M, K]) LockActive(ctx context.Context, tx *database.Tx, key K) (bool, error)
- func (d ModelIdentity[M, K]) ModelName() string
- func (d ModelIdentity[M, K]) Parse(stored model.Identity) (model.Reference[M, K], error)
- func (d ModelIdentity[M, K]) Reference(key K) model.Reference[M, K]
- func (d ModelIdentity[M, K]) ReferenceOf(m M) model.Reference[M, K]
- func (d ModelIdentity[M, K]) RetainedKeys(ctx context.Context, ex database.Executor, keys []K) ([]K, error)
- func (d ModelIdentity[M, K]) Scope(keys ...K) Predicate[M]
- func (d ModelIdentity[M, K]) Validate() error
- type NullableColumn
- func NullableBytesOf[M any, V ~[]byte](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableColumn[M, V]
- func NullableColumnOf[M, V any](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableColumn[M, V]
- func NullableIDOf[M, T any](b Builder[M], ptr *value.Nullable[model.ID[T]]) NullableColumn[M, model.ID[T]]
- func NullablePasswordOf[M any](b Builder[M], ptr *value.Nullable[password.Hash]) NullableColumn[M, password.Hash]
- func (c NullableColumn[M, V]) Asc() Order[M]
- func (c NullableColumn[M, V]) Desc() Order[M]
- func (c NullableColumn[M, V]) Eq(v V) Predicate[M]
- func (c NullableColumn[M, V]) In(v ...V) Predicate[M]
- func (c NullableColumn[M, V]) IsNotNull() Predicate[M]
- func (c NullableColumn[M, V]) IsNull() Predicate[M]
- func (c NullableColumn[M, V]) Ne(v V) Predicate[M]
- func (c NullableColumn[M, V]) NotIn(v ...V) Predicate[M]
- func (c NullableColumn[M, V]) Set(v V) Assignment[M]
- func (c NullableColumn[M, V]) SetNull() Assignment[M]
- type NullableEncrypted
- type NullableEnum
- func (c NullableEnum[M, E]) Asc() Order[M]
- func (c NullableEnum[M, E]) Desc() Order[M]
- func (c NullableEnum[M, E]) Eq(v E) Predicate[M]
- func (c NullableEnum[M, E]) In(v ...E) Predicate[M]
- func (c NullableEnum[M, E]) IsNotNull() Predicate[M]
- func (c NullableEnum[M, E]) IsNull() Predicate[M]
- func (c NullableEnum[M, E]) Ne(v E) Predicate[M]
- func (c NullableEnum[M, E]) NotIn(v ...E) Predicate[M]
- func (c NullableEnum[M, E]) Set(v E) Assignment[M]
- func (c NullableEnum[M, E]) SetNull() Assignment[M]
- type NullableInputColumn
- func (c NullableInputColumn[M, I, V]) Asc() Order[M]
- func (c NullableInputColumn[M, I, V]) Desc() Order[M]
- func (c NullableInputColumn[M, I, V]) Eq(v V) Predicate[M]
- func (c NullableInputColumn[M, I, V]) In(v ...V) Predicate[M]
- func (c NullableInputColumn[M, I, V]) IsNotNull() Predicate[M]
- func (c NullableInputColumn[M, I, V]) IsNull() Predicate[M]
- func (c NullableInputColumn[M, I, V]) Ne(v V) Predicate[M]
- func (c NullableInputColumn[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c NullableInputColumn[M, I, V]) Set(v I) Assignment[M]
- func (c NullableInputColumn[M, I, V]) SetNull() Assignment[M]
- type NullableInputEnum
- func (c NullableInputEnum[M, I, E]) Asc() Order[M]
- func (c NullableInputEnum[M, I, E]) Desc() Order[M]
- func (c NullableInputEnum[M, I, E]) Eq(v E) Predicate[M]
- func (c NullableInputEnum[M, I, E]) In(v ...E) Predicate[M]
- func (c NullableInputEnum[M, I, E]) IsNotNull() Predicate[M]
- func (c NullableInputEnum[M, I, E]) IsNull() Predicate[M]
- func (c NullableInputEnum[M, I, E]) Ne(v E) Predicate[M]
- func (c NullableInputEnum[M, I, E]) NotIn(v ...E) Predicate[M]
- func (c NullableInputEnum[M, I, E]) Set(v I) Assignment[M]
- func (c NullableInputEnum[M, I, E]) SetNull() Assignment[M]
- type NullableInputInterval
- func (c NullableInputInterval[M, I]) Asc() Order[M]
- func (c NullableInputInterval[M, I]) Between(a, b temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Desc() Order[M]
- func (c NullableInputInterval[M, I]) Eq(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Gt(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Gte(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) In(v ...temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) IsNotNull() Predicate[M]
- func (c NullableInputInterval[M, I]) IsNull() Predicate[M]
- func (c NullableInputInterval[M, I]) Lt(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Lte(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Ne(v temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) NotIn(v ...temporal.Interval) Predicate[M]
- func (c NullableInputInterval[M, I]) Set(v I) Assignment[M]
- func (c NullableInputInterval[M, I]) SetNull() Assignment[M]
- type NullableInputJSON
- func (c NullableInputJSON[M, I, T]) Asc() Order[M]
- func (c NullableInputJSON[M, I, T]) ContainedBy(v value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) Contains(v value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) Desc() Order[M]
- func (c NullableInputJSON[M, I, T]) Eq(v value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) In(v ...value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) IsJSONNull() Predicate[M]
- func (c NullableInputJSON[M, I, T]) IsNotNull() Predicate[M]
- func (c NullableInputJSON[M, I, T]) IsNull() Predicate[M]
- func (c NullableInputJSON[M, I, T]) Ne(v value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) NotIn(v ...value.JSON[T]) Predicate[M]
- func (c NullableInputJSON[M, I, T]) Set(v I) Assignment[M]
- func (c NullableInputJSON[M, I, T]) SetNull() Assignment[M]
- type NullableInputNumber
- func (c NullableInputNumber[M, I, V]) Asc() Order[M]
- func (c NullableInputNumber[M, I, V]) Between(a, b V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Desc() Order[M]
- func (c NullableInputNumber[M, I, V]) Eq(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Gt(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Gte(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) In(v ...V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) IsNotNull() Predicate[M]
- func (c NullableInputNumber[M, I, V]) IsNull() Predicate[M]
- func (c NullableInputNumber[M, I, V]) Lt(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Lte(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Ne(v V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c NullableInputNumber[M, I, V]) Set(v I) Assignment[M]
- func (c NullableInputNumber[M, I, V]) SetNull() Assignment[M]
- type NullableInputText
- func (c NullableInputText[M, I, V]) Asc() Order[M]
- func (c NullableInputText[M, I, V]) Between(a, b V) Predicate[M]
- func (c NullableInputText[M, I, V]) Contains(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Desc() Order[M]
- func (c NullableInputText[M, I, V]) EndsWith(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Eq(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Gt(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Gte(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) IContains(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) IEndsWith(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) ILike(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) IStartsWith(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) In(v ...V) Predicate[M]
- func (c NullableInputText[M, I, V]) IsNotNull() Predicate[M]
- func (c NullableInputText[M, I, V]) IsNull() Predicate[M]
- func (c NullableInputText[M, I, V]) Like(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Lt(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Lte(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) Ne(v V) Predicate[M]
- func (c NullableInputText[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c NullableInputText[M, I, V]) Set(v I) Assignment[M]
- func (c NullableInputText[M, I, V]) SetNull() Assignment[M]
- func (c NullableInputText[M, I, V]) StartsWith(v V) Predicate[M]
- type NullableInputTime
- func (c NullableInputTime[M, I, V]) Asc() Order[M]
- func (c NullableInputTime[M, I, V]) Between(a, b V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Desc() Order[M]
- func (c NullableInputTime[M, I, V]) Eq(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Gt(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Gte(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) In(v ...V) Predicate[M]
- func (c NullableInputTime[M, I, V]) IsNotNull() Predicate[M]
- func (c NullableInputTime[M, I, V]) IsNull() Predicate[M]
- func (c NullableInputTime[M, I, V]) Lt(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Lte(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Ne(v V) Predicate[M]
- func (c NullableInputTime[M, I, V]) NotIn(v ...V) Predicate[M]
- func (c NullableInputTime[M, I, V]) Set(v I) Assignment[M]
- func (c NullableInputTime[M, I, V]) SetNull() Assignment[M]
- type NullableInterval
- func (c NullableInterval[M]) Asc() Order[M]
- func (c NullableInterval[M]) Between(a, b temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Desc() Order[M]
- func (c NullableInterval[M]) Eq(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Gt(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Gte(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) In(v ...temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) IsNotNull() Predicate[M]
- func (c NullableInterval[M]) IsNull() Predicate[M]
- func (c NullableInterval[M]) Lt(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Lte(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Ne(v temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) NotIn(v ...temporal.Interval) Predicate[M]
- func (c NullableInterval[M]) Set(v temporal.Interval) Assignment[M]
- func (c NullableInterval[M]) SetNull() Assignment[M]
- type NullableJSON
- func (c NullableJSON[M, T]) Asc() Order[M]
- func (c NullableJSON[M, T]) ContainedBy(v value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) Contains(v value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) Desc() Order[M]
- func (c NullableJSON[M, T]) Eq(v value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) In(v ...value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) IsJSONNull() Predicate[M]
- func (c NullableJSON[M, T]) IsNotNull() Predicate[M]
- func (c NullableJSON[M, T]) IsNull() Predicate[M]
- func (c NullableJSON[M, T]) Ne(v value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) NotIn(v ...value.JSON[T]) Predicate[M]
- func (c NullableJSON[M, T]) Set(v value.JSON[T]) Assignment[M]
- func (c NullableJSON[M, T]) SetNull() Assignment[M]
- type NullableNumber
- func (c NullableNumber[M, V]) Asc() Order[M]
- func (c NullableNumber[M, V]) Between(a, b V) Predicate[M]
- func (c NullableNumber[M, V]) Decrement(amount V, bound ...Bound[V]) Assignment[M]
- func (c NullableNumber[M, V]) Desc() Order[M]
- func (c NullableNumber[M, V]) Eq(v V) Predicate[M]
- func (c NullableNumber[M, V]) Gt(v V) Predicate[M]
- func (c NullableNumber[M, V]) Gte(v V) Predicate[M]
- func (c NullableNumber[M, V]) In(v ...V) Predicate[M]
- func (c NullableNumber[M, V]) Increment(amount V, bound ...Bound[V]) Assignment[M]
- func (c NullableNumber[M, V]) IsNotNull() Predicate[M]
- func (c NullableNumber[M, V]) IsNull() Predicate[M]
- func (c NullableNumber[M, V]) Lt(v V) Predicate[M]
- func (c NullableNumber[M, V]) Lte(v V) Predicate[M]
- func (c NullableNumber[M, V]) Ne(v V) Predicate[M]
- func (c NullableNumber[M, V]) NotIn(v ...V) Predicate[M]
- func (c NullableNumber[M, V]) Set(v V) Assignment[M]
- func (c NullableNumber[M, V]) SetNull() Assignment[M]
- type NullableText
- func (c NullableText[M, V]) Asc() Order[M]
- func (c NullableText[M, V]) Between(a, b V) Predicate[M]
- func (c NullableText[M, V]) Contains(v V) Predicate[M]
- func (c NullableText[M, V]) Desc() Order[M]
- func (c NullableText[M, V]) EndsWith(v V) Predicate[M]
- func (c NullableText[M, V]) Eq(v V) Predicate[M]
- func (c NullableText[M, V]) Gt(v V) Predicate[M]
- func (c NullableText[M, V]) Gte(v V) Predicate[M]
- func (c NullableText[M, V]) IContains(v V) Predicate[M]
- func (c NullableText[M, V]) IEndsWith(v V) Predicate[M]
- func (c NullableText[M, V]) ILike(v V) Predicate[M]
- func (c NullableText[M, V]) IStartsWith(v V) Predicate[M]
- func (c NullableText[M, V]) In(v ...V) Predicate[M]
- func (c NullableText[M, V]) IsNotNull() Predicate[M]
- func (c NullableText[M, V]) IsNull() Predicate[M]
- func (c NullableText[M, V]) Like(v V) Predicate[M]
- func (c NullableText[M, V]) Lt(v V) Predicate[M]
- func (c NullableText[M, V]) Lte(v V) Predicate[M]
- func (c NullableText[M, V]) Ne(v V) Predicate[M]
- func (c NullableText[M, V]) NotIn(v ...V) Predicate[M]
- func (c NullableText[M, V]) Set(v V) Assignment[M]
- func (c NullableText[M, V]) SetNull() Assignment[M]
- func (c NullableText[M, V]) StartsWith(v V) Predicate[M]
- type NullableTime
- type Number
- type NumberLookupKey
- type NumberPrimary
- type NumberValue
- type Observer
- type One
- type Option
- type Order
- type OrderedExpressionColumn
- type PageRequest
- type PageResult
- type PivotChanges
- func Sync[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) (PivotChanges[P], error)
- func SyncWithoutDetaching[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) (PivotChanges[P], error)
- func Toggle[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], ...) (PivotChanges[P], error)
- type Plan
- func Explain[M any](ctx context.Context, ex database.Executor, q Query[M]) (Plan, error)
- func ExplainAnalyze[M any](ctx context.Context, ex database.Executor, q Query[M]) (Plan, error)
- func ExplainAnalyzeLocked[M any](ctx context.Context, tx *database.Tx, q LockedQuery[M]) (Plan, error)
- func ExplainLocked[M any](ctx context.Context, tx *database.Tx, q LockedQuery[M]) (Plan, error)
- type PlanNode
- type Predicate
- func And[M any](ps ...Predicate[M]) Predicate[M]
- func FoundryRelationFilter[M, N any](r ExistenceRelation[M, N], p ormcore.Predicate, seal sqlowner.MetadataSeal) Predicate[N]
- func FoundryRelationPredicate[M, N any](r ExistenceRelation[M, N], ps []ormcore.Predicate, seal sqlowner.MetadataSeal) Predicate[M]
- func Has[M, N any](r ExistenceRelation[M, N], ps ...Predicate[N]) Predicate[M]
- func Not[M any](p Predicate[M]) Predicate[M]
- func Or[M any](ps ...Predicate[M]) Predicate[M]
- func UUIDGreater[M, T any](column KeyColumn[M, model.ID[T]], v model.ID[T]) Predicate[M]
- func UUIDGreaterOrEqual[M, T any](column KeyColumn[M, model.ID[T]], v model.ID[T]) Predicate[M]
- func UUIDLess[M, T any](column KeyColumn[M, model.ID[T]], v model.ID[T]) Predicate[M]
- func UUIDLessOrEqual[M, T any](column KeyColumn[M, model.ID[T]], v model.ID[T]) Predicate[M]
- func WhereRaw[M any](sql string, args ...any) Predicate[M]
- type Primary
- type Query
- func FoundryOrderBy[M any](q Query[M], o ormcore.Order, seal sqlowner.QuerySeal) Query[M]
- func FoundryWhere[M any](q Query[M], p ormcore.Predicate, seal sqlowner.QuerySeal) Query[M]
- func WithRelationLimits[M any](q Query[M], limits RelationLimits) Query[M]
- func WithScopeContext[M any](q Query[M], ctx context.Context) Query[M]
- func WithoutGlobalScope[M any](q Query[M], scopes ...GlobalScope[M]) Query[M]
- func WithoutGlobalScopes[M any](q Query[M]) Query[M]
- func WithoutModelHooks[M any](q Query[M]) Query[M]
- func (q Query[M]) All(ctx context.Context, ex database.Executor) ([]M, error)
- func (q Query[M]) Chunk(ctx context.Context, ex database.Executor, size int, yield func([]M) error) error
- func (q Query[M]) Count(ctx context.Context, ex database.Executor) (int64, error)
- func (q Query[M]) DeleteAll(ctx context.Context, tx database.Transactor) (int64, error)
- func (q Query[M]) Each(ctx context.Context, ex database.Executor, yield func(M) error) error
- func (q Query[M]) EachChunked(ctx context.Context, ex database.Executor, size int, yield func(M) error) error
- func (q Query[M]) Exists(ctx context.Context, ex database.Executor) (bool, error)
- func (q Query[M]) First(ctx context.Context, ex database.Executor) (value.Optional[M], error)
- func (q Query[M]) ForKeyShare() LockedQuery[M]
- func (q Query[M]) ForNoKeyUpdate() LockedQuery[M]
- func (q Query[M]) ForShare() LockedQuery[M]
- func (q Query[M]) ForUpdate() LockedQuery[M]
- func (q Query[M]) ForceDeleteAll(ctx context.Context, tx database.Transactor, soft SoftDeletable[M]) (int64, error)
- func (q Query[M]) Limit(n int) Query[M]
- func (q Query[M]) Offset(n int) Query[M]
- func (q Query[M]) OnlyTrashed() Query[M]
- func (q Query[M]) OrderBy(os ...Order[M]) Query[M]
- func (q Query[M]) Paginate(ctx context.Context, ex database.Executor, request PageRequest) (PageResult[M], error)
- func (q Query[M]) Require(ctx context.Context, ex database.Executor) (M, error)
- func (q Query[M]) SimplePaginate(ctx context.Context, ex database.Executor, request PageRequest) (SimplePage[M], error)
- func (q Query[M]) UpdateAll(ctx context.Context, tx database.Transactor, as ...Assignment[M]) (int64, error)
- func (q Query[M]) Where(ps ...Predicate[M]) Query[M]
- func (q Query[M]) With(rels ...Relation[M]) Query[M]
- func (q Query[M]) WithTrashed() Query[M]
- func (q Query[M]) WithoutTrashed() Query[M]
- type RelatedLookup
- func (l RelatedLookup[P, M, K]) Find(ctx context.Context, ex database.Executor, parent P, key K) (value.Optional[M], error)
- func (RelatedLookup[P, M, K]) Format(s fmt.State, _ rune)
- func (RelatedLookup[P, M, K]) GoString() string
- func (RelatedLookup[P, M, K]) String() string
- func (l RelatedLookup[P, M, K]) Validate() error
- type Relation
- type RelationLimits
- type RetrievalHooks
- type RetrievalObserver
- type SimplePage
- type Slot
- type SoftDeletable
- type SoftDelete
- type SourceKey
- type Statement
- type Table
- func (t Table[M, K]) Delete(ctx context.Context, tx database.Transactor, key K) (M, error)
- func (t Table[M, K]) Find(ctx context.Context, ex database.Executor, key K) (value.Optional[M], error)
- func (t Table[M, K]) ForceDelete(ctx context.Context, tx database.Transactor, soft SoftDeletable[M], key K) (M, error)
- func (t Table[M, K]) Insert(ctx context.Context, tx database.Transactor, as ...Assignment[M]) (M, error)
- func (t Table[M, K]) InsertMany(ctx context.Context, tx database.Transactor, rows [][]Assignment[M]) ([]M, error)
- func (t Table[M, K]) Key() Key[M, K]
- func (t Table[M, K]) Query() Query[M]
- func (t Table[M, K]) Raw(ctx context.Context, ex database.Executor, sql string, args ...any) ([]M, error)
- func (t Table[M, K]) Require(ctx context.Context, ex database.Executor, key K) (M, error)
- func (t Table[M, K]) Restore(ctx context.Context, tx database.Transactor, key K) (M, error)
- func (t Table[M, K]) Update(ctx context.Context, tx database.Transactor, key K, as ...Assignment[M]) (M, error)
- type Text
- type TextExpressionColumn
- type TextLookupKey
- type TextPrimary
- type Through
- type ThroughRelation
- func ManyToManyOf[M, N, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], ...) ThroughRelation[M, N, P]
- func MorphToManyOf[M model.Morphable, N, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], ...) ThroughRelation[M, N, P]
- func MorphedByManyOf[M any, N model.Morphable, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], ...) ThroughRelation[M, N, P]
- func WithRelationWriteLimit[M, N, P any](r ThroughRelation[M, N, P], limit int) ThroughRelation[M, N, P]
- func WithoutPivotGlobalScope[M, N, P any](r ThroughRelation[M, N, P], scopes ...GlobalScope[P]) ThroughRelation[M, N, P]
- func WithoutPivotGlobalScopes[M, N, P any](r ThroughRelation[M, N, P]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) OnlyTrashed() ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) OnlyTrashedPivot() ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) OrderBy(orders ...Order[N]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) OrderByPivot(orders ...Order[P]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) Where(ps ...Predicate[N]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WherePivot(ps ...Predicate[P]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) With(children ...Relation[N]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WithPivot(children ...Relation[P]) ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WithTrashed() ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WithTrashedPivot() ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WithoutTrashed() ThroughRelation[M, N, P]
- func (r ThroughRelation[M, N, P]) WithoutTrashedPivot() ThroughRelation[M, N, P]
- type Time
- type TimeValue
- type UpdateMapping
- type UpdateSource
- func (p UpdateSource[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
- func (UpdateSource[S, M]) Format(s fmt.State, _ rune)
- func (p UpdateSource[S, M]) Match(key SourceKey[S, M]) UpdateSource[S, M]
- func (p UpdateSource[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
- func (p UpdateSource[S, M]) Select(mappings ...UpdateMapping[S, M]) UpdateSource[S, M]
- func (p UpdateSource[S, M]) Values(values ...Assignment[M]) UpdateSource[S, M]
- type UpdateTarget
- type UpdatedAt
- type Value
- type ValueLookup
- func (l ValueLookup[M, V]) AllExist(ctx context.Context, ex database.Executor, input []V) (bool, error)
- func (l ValueLookup[M, V]) AnyExist(ctx context.Context, ex database.Executor, input []V) (bool, error)
- func (l ValueLookup[M, V]) Exists(ctx context.Context, ex database.Executor, input V) (bool, error)
- func (l ValueLookup[M, V]) Format(s fmt.State, _ rune)
- func (l ValueLookup[M, V]) GoString() string
- func (ValueLookup[M, V]) String() string
- func (l ValueLookup[M, V]) Validate() error
- type Write
- type WriteError
Constants ¶
const DefaultChunkSize = querycore.DefaultChunkSize
DefaultChunkSize is the closed-batch size used by model iteration with eager relations or retrieval callbacks.
const MaxChunkSize = querycore.MaxChunkSize
MaxChunkSize is the existing bound on one model batch.
const MaxCursorBytes = querycore.MaxCursorBytes
MaxCursorBytes bounds the encoded cursor token accepted by ParseCursor.
const MaxCursorFields = querycore.MaxCursorFields
MaxCursorFields bounds the ordered fields in one cursor key.
const MaxExpressionDepth = querycore.MaxExpressionDepth
MaxExpressionDepth bounds nested expression and SELECT compilation.
const MaxExpressionNodes = querycore.MaxExpressionNodes
MaxExpressionNodes bounds expression and SELECT compilation work.
const MaxIdentityBatch = querycore.MaxIdentityBatch
MaxIdentityBatch bounds keys in one identity observation or extension scope.
const MaxInsertRows = querycore.MaxInsertRows
MaxInsertRows bounds rows in one atomic insert or upsert statement. The statement-wide MaxParameters limit can require smaller batches.
const MaxMembershipValues = querycore.MaxMembershipValues
MaxMembershipValues bounds the values in one membership predicate.
const MaxPageSize = querycore.MaxPageSize
MaxPageSize is the shared pagination bound. Example: size <= orm.MaxPageSize.
const MaxParameters = querycore.MaxParameters
MaxParameters bounds bound parameters across the whole SQL statement.
const MaxPerModelWriteRows = querycore.MaxPerModelWriteRows
MaxPerModelWriteRows bounds one atomic lifecycle batch. Example: limit <= orm.MaxPerModelWriteRows.
const MaxRelationWriteRows = querycore.MaxPerModelWriteRows
MaxRelationWriteRows bounds one atomic relation write. Example: len(targets) <= orm.MaxRelationWriteRows.
const MaxScalarSQLBytes = querycore.MaxScalarSQLBytes
MaxScalarSQLBytes bounds SQL emitted by computed scalar operations.
Variables ¶
var ErrBoundExceeded = safeerror.New("numeric adjustment bound exceeded")
ErrBoundExceeded means a guarded per-key adjustment rejected a visible row. A missing or hidden key returns database.NotFound instead.
Functions ¶
func Attach ¶
func Attach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, target N, create ...Assignment[P]) (P, error)
Attach creates one pivot with omitted endpoint keys supplied from locked models. Example: orm.Attach(ctx,db,UserRelations.Groups,user,group,Memberships.Role.Set("member")).
func AttachMany ¶
func AttachMany[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, targets []N, create ...Assignment[P]) ([]P, error)
AttachMany creates one pivot per distinct refreshed target key, retaining duplicate existing links. Example: orm.AttachMany(ctx,db,UserRelations.Groups,user,groups,Memberships.Role.Set("member")).
func Audit ¶
func Audit[M any, K comparable](table Table[M, K], changes Changes[M], policy AuditPolicy[M]) (auditrecord.Model[M, K], error)
Audit captures an automatic operation's stored changes without getters, mutators or SQL. Example: history, err := Audit(Orders.Table, changes, AuditPolicy[Order]{}).
func AuditRead ¶
func AuditRead[M, K, V any](history auditrecord.Model[M, K], field interface{ ormColumn(*M) columnData[V] }) (value.Optional[auditrecord.FieldChange[V]], error)
AuditRead reads a required historical field through its stored codec; omitted fields remain absent. Example: field, err := AuditRead(history, Orders.TotalCents).
func AuditReadEncrypted ¶
func AuditReadEncrypted[M, K any, V encrypted.Value[V]](history auditrecord.Model[M, K], field Encrypted[M, V]) (value.Optional[auditrecord.FieldChange[V]], error)
AuditReadEncrypted exposes encrypted history's redaction state, never ciphertext or plaintext. Example: field, err := AuditReadEncrypted(history, Vaults.Secret).
func AuditReadNullable ¶
func AuditReadNullable[M, K, V any](history auditrecord.Model[M, K], field interface{ ormColumn(*M) columnData[V] }) (value.Optional[auditrecord.FieldChange[value.Nullable[V]]], error)
AuditReadNullable keeps SQL NULL separate from an omitted field or absent model. Example: field, err := AuditReadNullable(history, Orders.Note).
func AuditReadNullableEncrypted ¶
func AuditReadNullableEncrypted[M, K any, V encrypted.Value[V]](history auditrecord.Model[M, K], field NullableEncrypted[M, V]) (value.Optional[auditrecord.FieldChange[value.Nullable[V]]], error)
AuditReadNullableEncrypted reads nullable encrypted history without fabricating a value for redaction. Example: field, err := AuditReadNullableEncrypted(history, Vaults.Backup).
func Auditing ¶
func Auditing[M any, K comparable](table Table[M, K], policy AuditPolicy[M]) auditrecord.Declaration
Auditing registers an instance-owned observer through audit.Register, inside the business transaction. Example: audit.Register(r, pool, recorderKey, config, Auditing(Orders.Table, policy)).
func ChangeOf ¶
func ChangeOf[M, V any](changes Changes[M], field interface{ ormColumn(*M) columnData[V] }) (lifecycle.FieldChange[V], error)
ChangeOf selects a required persisted field with its stored type. Example: ChangeOf(changes, Orders.TotalCents).
func Check ¶
func Check(tables ...CheckedTable) error
Check reports every declaration error. Example: if err := Check(Orders); err != nil { return err }.
func ChunkByKey ¶
func ChunkByKey[M any, K comparable](ctx context.Context, ex database.Executor, q Query[M], key KeyColumn[M, K], size int, yield func([]M) error) error
ChunkByKey advances by the declared primary key, with rows closed before each callback. Only key ordering and zero Offset are accepted; Limit bounds total delivery. Keys are captured before callbacks. Keep keys stable: batches do not share a snapshot. Example: orm.ChunkByKey(ctx, db, Orders.Query(), Orders.ID, 500, visit).
func CreateEach ¶
func CreateEach[M any](ctx context.Context, writer database.Transactor, q Query[M], drafts [][]Assignment[M]) ([]M, error)
CreateEach runs each creation lifecycle in one bounded atomic transaction. Unlike InsertMany, callbacks run per model; a valid empty batch performs no SQL. Example: orm.CreateEach(ctx, db, Users.Query(), [][]orm.Assignment[User]{{Users.Name.Set("Ada")}}).
func CreateOrFirst ¶
func CreateOrFirst[M any](ctx context.Context, writer database.Transactor, q Query[M], create ...Assignment[M]) (M, error)
CreateOrFirst creates through the model lifecycle in a savepoint, then reads the first primary-ordered match only if its own INSERT violates a unique index on this table. Failed hooks and uncertain outcomes never trigger recovery or retries. At snapshot isolation a competitor may be invisible; the original violation is then returned. Internal hydration skips Retrieved callbacks. Example: orm.CreateOrFirst(ctx, db, Users.Query().Where(Users.Email.Eq(email)), Users.Name.Set(name)).
func Define ¶
func Define[M any, T CheckedTable](name string, declare func(Builder[M], *M) T, opts ...Option) (result T)
Define binds and seals one table, collecting errors for Check. Example: Define("orders", declare).
func Delete ¶
func Delete[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], key Key[M, K], id K) (M, error)
Delete removes one primary key within the query's current visibility and returns its complete model. Declared soft deletion retains the physical row; otherwise deletion is physical. Example: orm.Delete(ctx, db, visible, Users.Key(), id).
func DeleteEach ¶
func DeleteEach[M any](ctx context.Context, writer database.Transactor, q Query[M], limit int) ([]M, error)
DeleteEach removes each active candidate through ordinary delete/soft-delete lifecycle callbacks. Overflow fails before callbacks, and later failures roll back the complete batch and its after-commit work. Results follow primary keys. Example: orm.DeleteEach(ctx,db,Notifications.Query().Where(Notifications.Read.Eq(true)),100).
func Detach ¶
func Detach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, target N) ([]P, error)
Detach removes matching active pivots, retaining soft-delete behavior and lifecycle. Example: orm.Detach(ctx,db,UserRelations.Groups,user,group).
func DetachAll ¶
func DetachAll[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M) ([]P, error)
DetachAll removes the source's links selected by pivot filters. Example: orm.DetachAll(ctx,db,UserRelations.Groups,user).
func DetachMany ¶
func DetachMany[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, targets []N) ([]P, error)
DetachMany removes all links to the requested targets within pivot filters. Example: orm.DetachMany(ctx,db,UserRelations.Groups,user,groups).
func EachByKey ¶
func EachByKey[M any, K comparable](ctx context.Context, ex database.Executor, q Query[M], key KeyColumn[M, K], size int, yield func(M) error) error
EachByKey yields individual models from complete primary-key batches. Example: orm.EachByKey(ctx, db, Orders.Query(), Orders.ID, 500, visit).
func EncryptedChangeOf ¶
func EncryptedChangeOf[M any, V encrypted.Value[V]](changes Changes[M], field Encrypted[M, V]) (lifecycle.FieldChange[V], error)
EncryptedChangeOf selects an encrypted field using decoded equality, without binding ciphertext. Example: EncryptedChangeOf(changes, Vaults.Secret).
func FirstOrCreate ¶
func FirstOrCreate[M any](ctx context.Context, writer database.Transactor, q Query[M], create ...Assignment[M]) (M, error)
FirstOrCreate locks the first primary-ordered match or creates through its lifecycle. Equality filters and scopes default omitted stored fields; mutator inputs need explicit assignments. Concurrent absence relies on unique constraints, without retries. Internal reads skip Retrieved. Example: orm.FirstOrCreate(ctx, db, Users.Query().Where(Users.Email.Eq(email)), Users.Name.Set(name)).
func ForceDelete ¶
func ForceDelete[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], soft SoftDeletable[M], key Key[M, K], id K) (M, error)
ForceDelete physically deletes one key within the query's current visibility. Example: ForceDelete(ctx,db,Orders.Query().WithTrashed(),Orders.Soft,Orders.Key(),id).
func ForceDeleteEach ¶
func ForceDeleteEach[M any](ctx context.Context, writer database.Transactor, q Query[M], soft SoftDeletable[M], limit int) ([]M, error)
ForceDeleteEach physically deletes selected soft-delete models in one bounded transaction, preserving the query's visibility and running each force-delete lifecycle. Returned models describe their persisted state before deletion. Example: orm.ForceDeleteEach(ctx, db, Users.Query().OnlyTrashed(), Users.Soft, 100).
func ForceDetach ¶
func ForceDetach[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], soft SoftDeletable[P], source M, target N) ([]P, error)
ForceDetach physically removes matching soft-delete pivots in the selected visibility. Example: orm.ForceDetach(ctx,db,UserRelations.Groups.WithTrashedPivot(),Memberships.Soft,user,group).
func ForcePruneBatch ¶
func ForcePruneBatch[M any](ctx context.Context, writer database.Transactor, q Query[M], soft SoftDeletable[M], size int, mass bool) (int64, error)
ForcePruneBatch physically removes a bounded soft-model batch within its visibility. Mass acknowledges skipping hooks, observers and change capture; selection still locks rows. Example: orm.ForcePruneBatch(ctx, db, Users.Query().OnlyTrashed(), Users.Soft, 100, false).
func FoundryCodec ¶
func FoundryCodec[V any](option ColumnOption[V], seal sqlowner.MetadataSeal) codec.Codec[V]
FoundryCodec supplies an explicit codec option to the row declaration package. Example: FoundryCodec(option, sqlowner.Metadata()).
func FoundryColumn ¶
func FoundryColumn[M, V, P any](column ExpressionColumn[M, V, P], seal sqlowner.MetadataSeal) (ormcore.Column[V], ormcore.Column[P])
FoundryColumn supplies comparison and projection codecs to expr/rows.
func FoundryConflictData ¶
func FoundryConflictData[M any](policy Conflict[M], seal sqlowner.ExpressionSeal) ormcore.ConflictPolicy
FoundryConflictData supplies policy data to the expression owner. Example: FoundryConflictData(policy,sqlowner.Expressions()).
func FoundryLockedRecord ¶
func FoundryLockedRecord[M any](q LockedQuery[M], seal sqlowner.MetadataSeal) ormcore.RecordSource
FoundryLockedRecord retains the model's lock inside a transaction-only record. Example: FoundryLockedRecord(Orders.Query().ForUpdate(),sqlowner.Metadata()).
func FoundryModel ¶
func FoundryModel[M any](q Query[M], seal sqlowner.MetadataSeal) (ormcore.Source, func(database.Row) (M, error))
FoundryModel supplies a validated model source and its existing hydration codec. Example: FoundryModel(q,sqlowner.Metadata()).
func FoundryModelRead ¶
func FoundryModelRead[M any](q Query[M], seal sqlowner.MetadataSeal) ormcore.RecordSource
FoundryModelRead retains complete hydration, retrieval and eager-load ownership. Example: FoundryModelRead(Users.Query().With(UserRelations.Orders),sqlowner.Metadata()).
func FoundryPredicate ¶
FoundryPredicate retains model declaration ownership in a projection. Example: FoundryPredicate(p,sqlowner.Metadata()).
func FoundryRecord ¶
FoundryRecord supplies complete model metadata through the validated metadata family. Example: FoundryRecord[Order](scope,sqlowner.Metadata()).
func FoundryRelatedValue ¶
func FoundryRelatedValue[M, N, V any](source AggregateSource[M, N], expression ormcore.Expression, column ormcore.Column[V], seal sqlowner.ExpressionSeal) ormcore.Expression
FoundryRelatedValue retains validated relation ownership in a row expression. Example: FoundryRelatedValue(source,expression,column,sqlowner.Expressions()).
func FoundrySlot ¶
func FoundrySlot[M any, K comparable, S any](key Key[M, K], slot Slot[M, S], seal sqlowner.MetadataSeal) (string, func(M) model.Reference[M, K], func(M) S, func(M, S) M, error)
FoundrySlot provides typed accessors only to framework metadata adapters. Example: orm.FoundrySlot(Articles.Key(),Articles.Title,sqlowner.Metadata()).
func FoundrySource ¶
FoundrySource supplies sealed model AST metadata to rows. Example: FoundrySource(Orders.Query(),sqlowner.Metadata()).
func InsertEach ¶
func InsertEach[M any, K comparable](ctx context.Context, writer database.Transactor, table Table[M, K], rows [][]Assignment[M]) ([]M, error)
InsertEach runs each row's ordinary lifecycle in one bounded transaction. A nested caller gets one savepoint for the batch, never one per row. Example: orm.InsertEach(ctx,db,Users.Table,[][]orm.Assignment[User]{{Users.Name.Set("Ada")}}).
func LoadFrom ¶
func LoadFrom[M any](ctx context.Context, ex database.Executor, q Query[M], parents []M) ([]M, error)
LoadFrom loads the query's relations onto copies of existing parents using its relation limits. Parent filters and windows are validated but do not re-fetch or filter supplied models. Errors publish no partial result. Example: loaded, err := orm.LoadFrom(ctx, db, q.With(OrderRelations.Buyer), orders).
func LoadMissingFrom ¶
func LoadMissingFrom[M any](ctx context.Context, ex database.Executor, q Query[M], parents []M) ([]M, error)
LoadMissingFrom uses the query's relation limits while preserving loaded slots, including loaded-empty slots. It performs no parent statement. Example: loaded, err := orm.LoadMissingFrom(ctx, db, q.With(OrderRelations.Buyer), orders).
func NullableChangeOf ¶
func NullableChangeOf[M, V any](changes Changes[M], field interface{ ormColumn(*M) columnData[V] }) (lifecycle.FieldChange[value.Nullable[V]], error)
NullableChangeOf retains SQL NULL independently of model existence. Example: NullableChangeOf(changes, Members.Note).
func NullableEncryptedChangeOf ¶
func NullableEncryptedChangeOf[M any, V encrypted.Value[V]](changes Changes[M], field NullableEncrypted[M, V]) (lifecycle.FieldChange[value.Nullable[V]], error)
NullableEncryptedChangeOf retains nullable encrypted snapshots without exposing predicates. Example: NullableEncryptedChangeOf(changes, Vaults.Backup).
func NumberKey ¶
func NumberKey[M any, K interface { NumberValue comparable }, R keyRole](key keyColumn[M, K, R]) numberKeyColumn[M, K, R]
NumberKey derives numeric capabilities without binding the field again.
func PruneBatch ¶
func PruneBatch[M any](ctx context.Context, writer database.Transactor, q Query[M], size int, mass bool) (int64, error)
PruneBatch physically removes at most size ordinary models in primary-key order. Mass explicitly skips per-model callbacks; otherwise ordinary deletion lifecycle runs. Soft-delete declarations require ForcePruneBatch and their declaration token. Example: orm.PruneBatch(ctx, db, Logs.Query().Where(Logs.Expired.Eq(true)), 100, false).
func RegisterObserver ¶
func RegisterObserver[M any](r *foundation.Registrar, pool foundation.Key[*database.DB], observer Observer[M], construct func(foundation.Resolver) (func() Hooks[M], error)) error
RegisterObserver installs instance-owned dependencies through a database Module. Example: RegisterObserver(r, pool, NewObserver[Order]("orders.audit"), constructOrderAudit).
func RegisterRetrievalObserver ¶
func RegisterRetrievalObserver[M any](r *foundation.Registrar, pool foundation.Key[*database.DB], observer RetrievalObserver[M], construct func(foundation.Resolver) (func() RetrievalHooks[M], error)) error
RegisterRetrievalObserver constructs dependencies once during application assembly. Example: RegisterRetrievalObserver(r, pool, NewRetrievalObserver[Order]("orders.read"), constructOrderReads).
func RestoreEach ¶
func RestoreEach[M any](ctx context.Context, writer database.Transactor, q Query[M], soft SoftDeletable[M], limit int) ([]M, error)
RestoreEach restores the selected deleted models in one bounded transaction. It retains predicates, selects only trashed rows, and runs each restore lifecycle. Example: orm.RestoreEach(ctx, db, Users.Query(), Users.Soft, 100).
func Update ¶
func Update[M any, K comparable](ctx context.Context, writer database.Transactor, q Query[M], key Key[M, K], id K, assignments ...Assignment[M]) (M, error)
Update patches one primary key within the query's current visibility and hydrates its complete returned model. Scope predicates, lifecycle and cardinality checks remain active. Example: orm.Update(ctx, db, visible, Users.Key(), id, Users.Name.Set("Ada")).
func UpdateEach ¶
func UpdateEach[M any](ctx context.Context, writer database.Transactor, q Query[M], limit int, draft func(context.Context, *database.Tx, M) ([]Assignment[M], error)) ([]M, error)
UpdateEach locks the complete candidate set in primary-key order, then derives typed assignments and runs each ordinary model lifecycle in one transaction. Read ordering, pagination, eager loading and WithoutModelHooks are rejected. The callback gets the actual transaction; propagate its context to nested work. Example: orm.UpdateEach(ctx,db,Users.Query(),100,func(ctx context.Context,tx *database.Tx,u User)([]orm.Assignment[User],error){return []orm.Assignment[User]{Users.Name.Set(u.Name)},nil}).
func UpdateOrCreate ¶
func UpdateOrCreate[M any](ctx context.Context, writer database.Transactor, q Query[M], create []Assignment[M], update func(context.Context, *database.Tx, M) ([]Assignment[M], error)) (M, error)
UpdateOrCreate patches the first locked match or creates from separate inputs. Only the chosen branch prepares its assignments. Read windows and eager loads are rejected. Example: orm.UpdateOrCreate(ctx,db,Users.Query(),create,func(ctx context.Context,tx *database.Tx,u User)([]orm.Assignment[User],error){return []orm.Assignment[User]{Users.Name.Set("Ada")},nil}).
func UpdatePivot ¶
func UpdatePivot[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, target N, update ...Assignment[P]) ([]P, error)
UpdatePivot patches every matching pivot to one target, including duplicate links. Example: orm.UpdatePivot(ctx,db,links,user,group,Memberships.Role.Set("admin")).
func Upsert ¶
func Upsert[M any](ctx context.Context, writer database.Transactor, q Query[M], policy Conflict[M], assignments ...Assignment[M]) (value.Optional[M], error)
Upsert inserts or applies a conflict policy. Skipped rows return an omitted value. Like the old upsert API, it transforms inputs but skips per-model hooks and observers. Example: orm.Upsert(ctx,db,Users.Query(),policy,Users.Email.Set("ada@example.test")).
func UpsertMany ¶
func UpsertMany[M any](ctx context.Context, writer database.Transactor, q Query[M], policy Conflict[M], rows [][]Assignment[M]) ([]M, error)
UpsertMany applies one reusable policy to a bounded atomic batch. Skipped rows are absent; RETURNING order is not an input-row mapping. Per-model callbacks are skipped. Example: orm.UpsertMany(ctx,db,Users.Query(),policy,[][]orm.Assignment[User]{{Users.Email.Set("ada@example.test")}}).
func WithoutRelationGlobalScope ¶
func WithoutRelationGlobalScope[M, N any, R scopeRelation[M, N, R]](r R, scopes ...GlobalScope[N]) R
WithoutRelationGlobalScope removes named target defaults without changing the relation kind or its pivot defaults. Example: WithoutRelationGlobalScope(UserRelations.Orders, orderTenantScope).Where(Orders.Active.Eq(true)).
func WithoutRelationGlobalScopes ¶
func WithoutRelationGlobalScopes[M, N any, R scopeRelation[M, N, R]](r R) R
WithoutRelationGlobalScopes removes all target defaults from this descriptor. Example: WithoutRelationGlobalScopes(UserRelations.Orders).
func WriteGet ¶
func WriteGet[M, I any](write *Write[M], setter func(I) Assignment[M]) value.Optional[I]
WriteGet reads a required field's input without running its mutator. Example: input, supplied := WriteGet(write, Members.Email.Set).Get().
func WriteIsSet ¶
func WriteIsSet[M, I any](write *Write[M], setter func(I) Assignment[M]) bool
WriteIsSet reports assignment independently of input value or NULL. Example: WriteIsSet(write, Members.Note.Set).
func WriteNullableGet ¶
func WriteNullableGet[M, I any](write *Write[M], setter func(I) Assignment[M]) value.Optional[value.Nullable[I]]
WriteNullableGet preserves omission, SQL NULL and the distinct mutation input. Example: input := WriteNullableGet(write, Members.Note.Set).
func WriteSet ¶
func WriteSet[M any](write *Write[M], assignments ...Assignment[M]) error
WriteSet replaces assigned fields; omission remains distinct from zero and NULL. Example: WriteSet(write, Members.Name.Set(""), Members.Note.SetNull()).
func WriteUnset ¶
func WriteUnset[M, I any](write *Write[M], setter func(I) Assignment[M]) error
WriteUnset removes a pending assignment; the field becomes omitted, not NULL or zero. Unsetting an omitted field is a no-op. Later hooks may assign it again, and conventions may supply an automatic value. Use only during a before-write callback. Example: WriteUnset(write, Members.EmailRevision.Set).
Types ¶
type AggregateRelation ¶
type AggregateRelation[M, V any] struct { // contains filtered or unexported fields }
AggregateRelation loads a typed computation into a model slot. Example: Users.Query().With(UserAggregates.OrdersCount).
func FoundryRelated ¶
func FoundryRelated[M, N, V any](source AggregateSource[M, N], expression ormcore.Expression, column ormcore.Column[V], seal sqlowner.ExpressionSeal) AggregateRelation[M, V]
FoundryRelated binds validated expression metadata to a sealed relation source. Example: orm.FoundryRelated(source,expression,column,sqlowner.Expressions()).
func (AggregateRelation[M, V]) Using ¶
func (r AggregateRelation[M, V]) Using(computation AggregateRelation[M, V]) AggregateRelation[M, V]
Using replaces the computation while retaining this descriptor's slot. Example: UserAggregates.OrdersCount.Using(expr.Related(filtered,expr.Count[Order]())).
type AggregateSource ¶
type AggregateSource[M, N any] interface { // contains filtered or unexported methods }
AggregateSource seals the parent and measured model of a relation computation. Example: func count[M,N any](r orm.AggregateSource[M,N]).
func Pivot ¶
func Pivot[M, N, P any](r ThroughRelation[M, N, P]) AggregateSource[M, P]
Pivot measures a relation's pivot while preserving both sides' scopes. Example: expr.Related(orm.Pivot(UserRelations.Groups),expr.Count[Membership]()).
type Assignment ¶
type Assignment[M any] struct { // contains filtered or unexported fields }
Assignment preserves omitted/null/value semantics. Example: Orders.TotalCents.Set(0).
func (Assignment[M]) GoString ¶
func (Assignment[M]) GoString() string
GoString redacts pending values in diagnostics. Example: fmt.Sprintf("%#v", assignment).
func (Assignment[M]) String ¶
func (Assignment[M]) String() string
String redacts pending values. Example: fmt.Sprint(Orders.TotalCents.Set(10)).
type AuditPolicy ¶
type AuditPolicy[M any] struct { // contains filtered or unexported fields }
AuditPolicy is an immutable model-owned disclosure policy; zero means Automatic for every field. Example: AuditPolicyOf(Orders.Table, AuditField(Orders.Note, record.Exclude)).
func AuditPolicyOf ¶
func AuditPolicyOf[M any, K comparable](table Table[M, K], rules ...AuditRule[M]) AuditPolicy[M]
AuditPolicyOf snapshots field policies; duplicates, foreign fields and hidden primary keys fail registration or capture. Example: AuditPolicyOf(Orders.Table, AuditField(Orders.Note, record.Exclude)).
type AuditRule ¶
type AuditRule[M any] struct { // contains filtered or unexported fields }
AuditRule retains the model owner of a field disclosure. Example: AuditField(Orders.Note, record.Exclude).
func AuditEncryptedField ¶
func AuditEncryptedField[M any, V encrypted.Value[V]](field Encrypted[M, V], disclosure auditrecord.Disclosure) AuditRule[M]
AuditEncryptedField selects exclusion or redaction for an encrypted field; Automatic always redacts. Example: AuditEncryptedField(Vaults.Secret, record.Exclude).
func AuditField ¶
func AuditField[M, V any](field interface{ ormColumn(*M) columnData[V] }, disclosure auditrecord.Disclosure) AuditRule[M]
AuditField selects disclosure for a declared stored column, including nullable and distinct-input columns. Example: AuditField(Orders.Note, record.Redact).
func AuditNullableEncryptedField ¶
func AuditNullableEncryptedField[M any, V encrypted.Value[V]](field NullableEncrypted[M, V], disclosure auditrecord.Disclosure) AuditRule[M]
AuditNullableEncryptedField selects disclosure for a nullable encrypted field. Example: AuditNullableEncryptedField(Vaults.Backup, record.Exclude).
type BelongsTo ¶
type BelongsTo[M, N any] struct { // contains filtered or unexported fields }
BelongsTo loads a singular target using a local FK. Example: OrderRelations.Buyer.
func BelongsToOf ¶
func BelongsToOf[M, N any, K comparable](slot One[M, N], local KeyColumn[M, K], foreign KeyColumn[N, K]) BelongsTo[M, N]
BelongsToOf unifies local and target key types. Example: BelongsToOf(Orders.Buyer,Orders.BuyerID,Users.ID).
func MorphToOf ¶
func MorphToOf[M any, N model.Morphable, K comparable](slot One[M, N], id KeyColumn[M, K], kind KeyColumn[M, model.MorphName], key KeyColumn[N, K]) BelongsTo[M, N]
MorphToOf loads one concrete target only for matching source rows. Declare one slot per target type. Example: orm.MorphToOf(Comments.Post,Comments.OwnerID,Comments.OwnerType,Posts.ID).
func (BelongsTo[M, N]) LatestOfMany ¶
LatestOfMany chooses the highest target primary key. Example: OrderRelations.Buyer.LatestOfMany().
func (BelongsTo[M, N]) OfMany ¶
OfMany chooses one target per local key using these orders and the primary key. Example: OrderRelations.Buyer.OfMany(Users.ID.Asc()).
func (BelongsTo[M, N]) OldestOfMany ¶
OldestOfMany chooses the lowest target primary key. Example: OrderRelations.Buyer.OldestOfMany().
func (BelongsTo[M, N]) OnlyTrashed ¶
OnlyTrashed sets target soft-delete visibility. Example: UserRelations.Orders.OnlyTrashed().
func (BelongsTo[M, N]) OrderBy ¶
OrderBy orders related rows with a primary-key tie-breaker. Example: OrderRelations.Buyer.OrderBy(Users.Email.Asc()).
func (BelongsTo[M, N]) Where ¶
Where constrains related rows. Example: OrderRelations.Buyer.Where(Users.Age.Gt(18)).
func (BelongsTo[M, N]) With ¶
With batches nested branches over all fetched targets. Example: OrderRelations.Buyer.With(UserRelations.Orders).
func (BelongsTo[M, N]) WithTrashed ¶
WithTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithTrashed().
func (BelongsTo[M, N]) WithoutTrashed ¶
WithoutTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithoutTrashed().
type Bound ¶
type Bound[V NumberValue] struct { // contains filtered or unexported fields }
Bound constrains the result of an atomic numeric adjustment. Construct bounds with AtLeast or AtMost; the zero value is invalid. The database evaluates column +/- amount before comparing the bound. int64/float64 overflow returns a database out-of-range error; it never silently passes the guard.
func AtLeast ¶
func AtLeast[V NumberValue](floor V) Bound[V]
AtLeast requires the decremented value to remain at or above floor.
func AtMost ¶
func AtMost[V NumberValue](ceiling V) Bound[V]
AtMost requires the incremented value to remain at or below ceiling.
type Builder ¶
type Builder[M any] struct { // contains filtered or unexported fields }
Builder binds fields during Define. Example: TextOf(b, &o.Email).
type Changes ¶
type Changes[M any] struct { // contains filtered or unexported fields }
Changes contains persisted snapshots, excluding relations and ignored fields. Example: original, exists := changes.Before().Get().
func Compare ¶
func Compare[M any, K comparable](table Table[M, K], before, after value.Optional[M], assigned ...Assignment[M]) (Changes[M], error)
Compare compares stored snapshots without running hooks, accessors or mutators. Example: Compare(Orders.Table, value.Set(before), value.Set(after), Orders.TotalCents.Set(0)).
func (Changes[M]) After ¶
After returns an owned stored result, absent for physical deletion. Example: changes.After().Get().
func (Changes[M]) Assigned ¶
Assigned reports effective assignments, including managed fields. Example: changes.Assigned().
func (Changes[M]) Before ¶
Before returns an owned persisted original, absent for creation. Example: changes.Before().Get().
func (Changes[M]) Changed ¶
Changed reports canonical stored differences. Example: changes.Changed().
type CheckedTable ¶
type CheckedTable interface {
// contains filtered or unexported methods
}
CheckedTable is implemented by embedded tables. Example: Check(Orders, Users).
type Column ¶
type Column[M, V any] struct { // contains filtered or unexported fields }
Column exposes equality, ordering and assignments. Example: Orders.BuyerID.Eq(id).
func BoolOf ¶
func BoolOf[M any, V ~bool](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
BoolOf binds a Boolean field, including defined Boolean types. Example: BoolOf(b, &u.Enabled).
func BytesOf ¶
func BytesOf[M any, V ~[]byte](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
BytesOf binds owned byte buffers. Example: BytesOf(b,&o.Payload).
func ColumnOf ¶
func ColumnOf[M, V any](b Builder[M], ptr *V, opts ...ColumnOption[V]) Column[M, V]
ColumnOf binds an ordinary field or explicit custom codec. Example: ColumnOf(b,&o.BuyerID).
func PasswordOf ¶
PasswordOf binds a stored hash with scalar comparisons, sorting and assignment. Plaintext verification belongs to password.Hasher. Example: Accounts.Digest.Eq(hash).
func (Column[M, V]) Set ¶
func (c Column[M, V]) Set(v V) Assignment[M]
Set assigns a value, including zero. Example: Orders.BuyerID.Set(userID).
type ColumnOption ¶
type ColumnOption[V any] struct { // contains filtered or unexported fields }
ColumnOption supplies a typed custom codec. Example: ColumnOf(b, &o.Code, Codec(custom)).
type Conflict ¶
type Conflict[M any] struct { // contains filtered or unexported fields }
Conflict is an immutable model-owned upsert policy; its zero value is invalid. Example: orm.OnConflict(orm.ConflictKey(Users.Email)).DoUpdate(orm.ConflictIncoming(Users.Name)).
func FoundryConflict ¶
func FoundryConflict[M any](metadata ormcore.ConflictPolicy, seal sqlowner.ExpressionSeal) Conflict[M]
FoundryConflict binds a framework-built policy to its declaration. Example: FoundryConflict[User](metadata,sqlowner.Expressions()).
func OnConflict ¶
func OnConflict[M any](fields ...ConflictColumn[M]) Conflict[M]
OnConflict infers a unique index from typed columns. Empty targets support DO NOTHING. Example: orm.OnConflict(orm.ConflictKey(Users.Email)).DoNothing().
func OnConflictConstraint ¶
OnConflictConstraint selects a named database constraint; PostgreSQL owns its existence. Example: orm.OnConflictConstraint[User]("users_email_key").DoNothing().
func (Conflict[M]) DoNothing ¶
DoNothing skips conflicting rows; skipped rows have no result. Example: orm.OnConflict[User]().DoNothing().
func (Conflict[M]) DoUpdate ¶
func (p Conflict[M]) DoUpdate(updates ...ConflictUpdate[M]) Conflict[M]
DoUpdate replaces the policy's update assignments. Primary-key updates are rejected. Example: policy.DoUpdate(orm.ConflictIncoming(Users.Name)).
func (Conflict[M]) GoString ¶
GoString omits captured conflict values. Example: fmt.Sprintf("%#v",policy).
func (Conflict[M]) TargetWhere ¶
TargetWhere declares a partial unique index predicate, separate from update conditions. Fixed target values are rendered as schema constants. Example: policy.TargetWhere(Users.Active.Eq(true)).
type ConflictColumn ¶
type ConflictColumn[M any] struct { // contains filtered or unexported fields }
ConflictColumn is a model-owned unique-index column. Example: orm.ConflictKey(Users.Email).
func ConflictKey ¶
func ConflictKey[M, V any](field interface{ ormColumn(*M) columnData[V] }) ConflictColumn[M]
ConflictKey selects a declared column for unique-index inference. Example: orm.OnConflict(orm.ConflictKey(Users.Email)).DoNothing().
type ConflictUpdate ¶
type ConflictUpdate[M any] struct { // contains filtered or unexported fields }
ConflictUpdate is a model-owned assignment in DO UPDATE. Example: orm.ConflictIncoming(Users.Email).
func ConflictIncoming ¶
func ConflictIncoming[M, V any](field interface{ ormColumn(*M) columnData[V] }) ConflictUpdate[M]
ConflictIncoming copies the destination's own EXCLUDED value, already transformed. Omitted insert values copy the database default or NULL. Encrypted fields are excluded. Example: orm.ConflictIncoming(Users.Email).
func ConflictNull ¶
func ConflictNull[M, V any](field ExpressionColumn[M, V, value.Nullable[V]]) ConflictUpdate[M]
ConflictNull clears a nullable field without invoking its mutator. Example: orm.ConflictNull(Users.Nickname).
func ConflictSet ¶
func ConflictSet[M, I, V any, F conflictAssignment[M, I, V]](field F, input I) ConflictUpdate[M]
ConflictSet captures the column's write input, including distinct mutator inputs. Encrypted fields have no conflict assignment capability. Example: orm.ConflictSet(Users.Email,EmailInput{Address:"ada@example.test"}).
func FoundryConflictUpdate ¶
func FoundryConflictUpdate[M any](metadata ormcore.ConflictAssignment, seal sqlowner.ExpressionSeal) ConflictUpdate[M]
FoundryConflictUpdate binds a framework-built calculation to its destination. Example: FoundryConflictUpdate[User](metadata,sqlowner.Expressions()).
func (ConflictUpdate[M]) GoString ¶
func (ConflictUpdate[M]) GoString() string
GoString redacts literal inputs. Example: fmt.Sprintf("%#v",update).
func (ConflictUpdate[M]) String ¶
func (ConflictUpdate[M]) String() string
String redacts literal inputs. Example: fmt.Sprint(orm.ConflictSet(Users.Email,"ada@example.test")).
type CreatedAt ¶
type CreatedAt[M any, V InstantValue] = timeColumn[M, V, createdRole]
CreatedAt is an explicitly managed creation instant. Example: CreatedAtOf(b,&o.CreatedAt).
func CreatedAtOf ¶
func CreatedAtOf[M any, V InstantValue](b Builder[M], ptr *V) CreatedAt[M, V]
CreatedAtOf explicitly marks a creation timestamp. Example: CreatedAtOf(b,&o.CreatedAt).
type Cursor ¶
Cursor is the existing owner-typed position token, preserving its wire identity. Example: var next orm.Cursor[User].
type CursorInputError ¶
type CursorInputError = querycore.CursorInputError
CursorInputError preserves typed cursor error classification. Example: var invalid *orm.CursorInputError.
type CursorPage ¶
type CursorPage[M any] = querycore.CursorPage[M]
CursorPage preserves the existing keyset response. Example: page.Next.Get().
func CursorPaginate ¶
func CursorPaginate[M any](ctx context.Context, ex database.Executor, q Query[M], request CursorRequest[M]) (CursorPage[M], error)
CursorPaginate reads a bounded keyset page using the existing HTTP pagination request/result adapters. Tokens are scoped positions, not authorization or a snapshot. Example: orm.CursorPaginate(ctx, db, Orders.Query(), request.Page).
type CursorRequest ¶
type CursorRequest[M any] = querycore.CursorRequest[M]
CursorRequest preserves the existing bounded keyset request. Example: orm.CursorRequest[User]{Size:20}.
type DeleteSource ¶
type DeleteSource[S, M any] struct { // contains filtered or unexported fields }
DeleteSource removes matching models using declared soft-delete conventions. Example: rows.DeleteUsing(Users.Query(),rows.From(Archives.Query())).
func FoundryDeleteUsing ¶
func FoundryDeleteUsing[S, M any](q Query[M], source ormcore.Source, force bool, soft SoftDeletable[M], seal sqlowner.QuerySeal) DeleteSource[S, M]
FoundryDeleteUsing creates a source removal plan with explicit visibility. Example: FoundryDeleteUsing[Archive](Users.Query(),source,false,SoftDeletable[User]{},sqlowner.Queries()).
func (DeleteSource[S, M]) Exec ¶
func (p DeleteSource[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
Exec affects each matching destination once. Example: plan.Exec(ctx,db).
func (DeleteSource[S, M]) Format ¶
func (DeleteSource[S, M]) Format(s fmt.State, _ rune)
Format hides captured source values. Example: fmt.Sprintf("%#v",plan).
func (DeleteSource[S, M]) Match ¶
func (p DeleteSource[S, M]) Match(key SourceKey[S, M]) DeleteSource[S, M]
Match replaces the source-to-primary match. Example: plan.Match(rows.MatchSource(Users.ID,expr.Value(Archives.UserID))).
func (DeleteSource[S, M]) Returning ¶
func (p DeleteSource[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
Returning returns complete affected models; physical deletion returns old values. Example: plan.Returning(ctx,db,100).
type DirectRelation ¶
type DirectRelation[P, M any] interface { BelongsTo[P, M] | HasOne[P, M] | HasMany[P, M] AggregateSource[P, M] }
DirectRelation restricts scoped binding to direct relationships. Example: func bind[R orm.DirectRelation[Team,Project]](r R).
type Encrypted ¶
Encrypted exposes only typed assignment; ciphertext has no predicate or ordering capabilities. Example: Vaults.Secret.Set(encrypted.NewText("private")).
func EncryptedJSONOf ¶
func EncryptedJSONOf[M, T any](b Builder[M], ptr *encrypted.JSON[T]) Encrypted[M, encrypted.JSON[T]]
EncryptedJSONOf binds a typed JSON envelope. Example: EncryptedJSONOf(b,&m.Settings).
func EncryptedTextOf ¶
EncryptedTextOf binds a text envelope to its table, column and row key. Example: EncryptedTextOf(b,&m.Secret).
func (Encrypted[M, V]) Set ¶
func (c Encrypted[M, V]) Set(v V) Assignment[M]
Set captures a typed value for sealing inside the write transaction. Example: Vaults.Secret.Set(encrypted.NewText("private")).
type Enum ¶
Enum restricts values to an enum's descriptor. Example: Users.Status.Eq(StatusActive).
func EnumOf ¶
func EnumOf[M any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }](b Builder[M], ptr *E, opts ...ColumnOption[E]) Enum[M, E]
EnumOf uses generated enum metadata. Example: EnumOf(b,&o.Status).
func (Enum[M, E]) Set ¶
func (c Enum[M, E]) Set(v E) Assignment[M]
Set assigns a value, including zero. Example: Users.Status.Set(StatusActive).
type ExistenceRelation ¶
type ExistenceRelation[M, N any] interface { Relation[M] // contains filtered or unexported methods }
ExistenceRelation retains both source and target owners for predicate inference. Example: orm.Has(UserRelations.Orders, Orders.TotalCents.Gt(100)).
type ExpressionColumn ¶
type ExpressionColumn[M, V, P any] interface { // contains filtered or unexported methods }
ExpressionColumn preserves a column's model and SQL value type. Example: rows.SelectValue(Orders.Query(),Orders.TotalCents).
type ExtensionRelation ¶
type ExtensionRelation[M any] struct { // contains filtered or unexported fields }
ExtensionRelation is a model-owned external-store loader. Example: Articles.Query().With(title).
func FoundryExtension ¶
func FoundryExtension[M, S any](slot Slot[M, S], source extensionslot.Slot[M], seal sqlowner.QuerySeal) ExtensionRelation[M]
FoundryExtension binds a shared external loader using a validated framework capability. Example: orm.FoundryExtension(Articles.Title,loader,sqlowner.Queries()).
type GlobalScope ¶
type GlobalScope[M any] struct { // contains filtered or unexported fields }
GlobalScope is a model-owned, additive default predicate. Keep its value for query-local removal. Example: var tenantScope orm.GlobalScope[Order].
func Scope ¶
func Scope[M any, K comparable](table Table[M, K], name string, resolve func(context.Context) (Predicate[M], error)) GlobalScope[M]
Scope resolves a predicate with the executing context on every statement. A missing tenant must return an error. Example: orm.Scope(Orders.Table, "tenant", func(ctx context.Context) (orm.Predicate[Order], error) { id, err := tenantID(ctx); return Orders.TenantID.Eq(id), err }).
func (GlobalScope[M]) Name ¶
func (s GlobalScope[M]) Name() string
Name returns the declared identifier. Example: tenantScope.Name().
type HasMany ¶
type HasMany[M, N any] struct { // contains filtered or unexported fields }
HasMany loads target collections by their FK. Example: UserRelations.Orders.
func HasManyOf ¶
func HasManyOf[M, N any, K comparable](slot Many[M, N], local KeyColumn[M, K], foreign KeyColumn[N, K]) HasMany[M, N]
HasManyOf unifies parent keys with target FKs. Example: HasManyOf(Users.Orders,Users.ID,Orders.BuyerID).
func HasManyThroughOf ¶
func HasManyThroughOf[M, I, N any, A, B comparable](slot Many[M, N], local KeyColumn[M, A], first KeyColumn[I, A], second KeyColumn[I, B], foreign KeyColumn[N, B]) HasMany[M, N]
HasManyThroughOf unifies both key pairs via an intermediate model. Example: orm.HasManyThroughOf(Countries.Posts,Countries.ID,Users.CountryID,Users.ID,Posts.UserID).
func MorphManyOf ¶
func MorphManyOf[M model.Morphable, N any, K comparable](slot Many[M, N], local KeyColumn[M, K], id KeyColumn[N, K], kind KeyColumn[N, model.MorphName]) HasMany[M, N]
MorphManyOf filters targets by the source discriminator. Example: orm.MorphManyOf(Posts.Comments,Posts.ID,Comments.OwnerID,Comments.OwnerType).
func (HasMany[M, N]) OnlyTrashed ¶
OnlyTrashed sets target soft-delete visibility. Example: UserRelations.Orders.OnlyTrashed().
func (HasMany[M, N]) OrderBy ¶
OrderBy orders related collections. Example: UserRelations.Orders.OrderBy(Orders.TotalCents.Desc()).
func (HasMany[M, N]) Where ¶
Where constrains related rows. Example: UserRelations.Orders.Where(Orders.TotalCents.Gt(100)).
func (HasMany[M, N]) With ¶
With batches nested branches over all fetched targets. Example: UserRelations.Orders.With(OrderRelations.Buyer).
func (HasMany[M, N]) WithTrashed ¶
WithTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithTrashed().
func (HasMany[M, N]) WithoutTrashed ¶
WithoutTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithoutTrashed().
type HasOne ¶
type HasOne[M, N any] struct { // contains filtered or unexported fields }
HasOne loads at most one target by its FK. Example: UserRelations.Profile.
func HasOneOf ¶
func HasOneOf[M, N any, K comparable](slot One[M, N], local KeyColumn[M, K], foreign KeyColumn[N, K]) HasOne[M, N]
HasOneOf unifies the parent key and target FK and rejects multiple matches. Example: HasOneOf(Users.Profile,Users.ID,Profiles.UserID).
func HasOneThroughOf ¶
func HasOneThroughOf[M, I, N any, A, B comparable](slot One[M, N], local KeyColumn[M, A], first KeyColumn[I, A], second KeyColumn[I, B], foreign KeyColumn[N, B]) HasOne[M, N]
HasOneThroughOf loads at most one target per source via an intermediate. Example: orm.HasOneThroughOf(Countries.LatestPost,Countries.ID,Users.CountryID,Users.ID,Posts.UserID).
func MorphOneOf ¶
func MorphOneOf[M model.Morphable, N any, K comparable](slot One[M, N], local KeyColumn[M, K], id KeyColumn[N, K], kind KeyColumn[N, model.MorphName]) HasOne[M, N]
MorphOneOf loads at most one target of the source discriminator. Example: orm.MorphOneOf(Posts.Cover,Posts.ID,Images.OwnerID,Images.OwnerType).
func (HasOne[M, N]) LatestOfMany ¶
LatestOfMany chooses the highest target primary key. Example: UserRelations.LatestOrder.LatestOfMany().
func (HasOne[M, N]) OfMany ¶
OfMany chooses the first target per parent in these orders, then primary key. Example: UserRelations.LatestOrder.OfMany(Orders.TotalCents.Desc()).
func (HasOne[M, N]) OldestOfMany ¶
OldestOfMany chooses the lowest target primary key. Example: UserRelations.LatestOrder.OldestOfMany().
func (HasOne[M, N]) OnlyTrashed ¶
OnlyTrashed sets target soft-delete visibility. Example: UserRelations.Orders.OnlyTrashed().
func (HasOne[M, N]) OrderBy ¶
OrderBy orders related rows without hiding cardinality errors. Example: UserRelations.Profile.OrderBy(Profiles.ID.Asc()).
func (HasOne[M, N]) Where ¶
Where constrains related rows. Example: UserRelations.Profile.Where(Profiles.Active.Eq(true)).
func (HasOne[M, N]) With ¶
With batches nested branches over all fetched targets. Example: UserRelations.Profile.With(ProfileRelations.Photo).
func (HasOne[M, N]) WithTrashed ¶
WithTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithTrashed().
func (HasOne[M, N]) WithoutTrashed ¶
WithoutTrashed sets target soft-delete visibility. Example: UserRelations.Orders.WithoutTrashed().
type Hooks ¶
type Hooks[M any] struct { // Saving precedes Creating/Updating. Example: Saving: validateOrder. Saving func(context.Context, *database.Tx, value.Optional[M], *Write[M]) error // Creating can supply omitted required fields. Example: Creating: initializeOrder. Creating func(context.Context, *database.Tx, *Write[M]) error // Updating receives the locked original. Example: Updating: reviseOrder. Updating func(context.Context, *database.Tx, M, *Write[M]) error // Deleting precedes soft and physical deletion. Example: Deleting: authorizeRemoval. Deleting func(context.Context, *database.Tx, M) error // Restoring precedes restoring a deleted row. Example: Restoring: authorizeRestore. Restoring func(context.Context, *database.Tx, M) error // ForceDeleting precedes Deleting. Example: ForceDeleting: authorizePurge. ForceDeleting func(context.Context, *database.Tx, M) error // Created runs after RETURNING, inside the transaction. Example: Created: recordCreation. Created func(context.Context, *database.Tx, Changes[M]) error // Updated runs after RETURNING, inside the transaction. Example: Updated: recordRevision. Updated func(context.Context, *database.Tx, Changes[M]) error // Deleted runs after soft or physical deletion. Example: Deleted: recordRemoval. Deleted func(context.Context, *database.Tx, Changes[M]) error // Saved follows Created/Updated. Example: Saved: writeOutbox. Saved func(context.Context, *database.Tx, Changes[M]) error // Restored runs after restoration. Example: Restored: recordRestore. Restored func(context.Context, *database.Tx, Changes[M]) error // ForceDeleted follows Deleted. Example: ForceDeleted: recordPurge. ForceDeleted func(context.Context, *database.Tx, Changes[M]) error // AfterCommit runs after the outer commit; it is not crash durable. Example: AfterCommit: invalidateCache. AfterCommit func(context.Context, lifecycle.Operation, Changes[M]) error }
Hooks declares operation-local write callbacks; nil callbacks are skipped. Example: Hooks[Order]{Creating: func(ctx context.Context, tx *database.Tx, w *Write[Order]) error { return WriteSet(w, Orders.TotalCents.Set(0)) }}.
type InputColumn ¶
InputColumn accepts I for writes and retains V for stored operations. Example: InputColumn[Member, EmailInput, StoredEmail].
func InputBytesOf ¶
func InputBytesOf[M, I any, V ~[]byte](b Builder[M], ptr *V, transform func(I) (V, error)) InputColumn[M, I, V]
InputBytesOf binds owned stored bytes and a concrete input. Example: InputBytesOf[Document, BodyInput](b, &document.Body, encodeBody).
func InputColumnOf ¶
func InputColumnOf[M, I any, V any](b Builder[M], ptr *V, transform func(I) (V, error), opts ...ColumnOption[V]) InputColumn[M, I, V]
InputColumnOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputColumnOf[Member, EmailInput](b, &member.Email, nil).
func (InputColumn[M, I, V]) Asc ¶
func (c InputColumn[M, I, V]) Asc() Order[M]
Asc retains the stored column operation; Set alone accepts I. Example: members.Email.Asc().
func (InputColumn[M, I, V]) Desc ¶
func (c InputColumn[M, I, V]) Desc() Order[M]
Desc retains the stored column operation; Set alone accepts I. Example: members.Email.Desc().
func (InputColumn[M, I, V]) Eq ¶
func (c InputColumn[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored column operation; Set alone accepts I. Example: members.Email.Eq(StoredEmail("ada@example.test")).
func (InputColumn[M, I, V]) In ¶
func (c InputColumn[M, I, V]) In(v ...V) Predicate[M]
In retains the stored column operation; Set alone accepts I. Example: members.Email.In(StoredEmail("ada@example.test")).
func (InputColumn[M, I, V]) Ne ¶
func (c InputColumn[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored column operation; Set alone accepts I. Example: members.Email.Ne(StoredEmail("ada@example.test")).
func (InputColumn[M, I, V]) NotIn ¶
func (c InputColumn[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored column operation; Set alone accepts I. Example: members.Email.NotIn(StoredEmail("ada@example.test")).
func (InputColumn[M, I, V]) Set ¶
func (c InputColumn[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Email.Set(EmailInput{Address: "ada@example.test"}).
type InputEnum ¶
type InputEnum[M, I any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }] struct { // contains filtered or unexported fields }
InputEnum accepts I for writes and retains E for stored operations. Example: InputEnum[Member, StatusInput, Status].
func InputEnumOf ¶
func InputEnumOf[M, I any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }](b Builder[M], ptr *E, transform func(I) (E, error), opts ...ColumnOption[E]) InputEnum[M, I, E]
InputEnumOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputEnumOf[Member, StatusInput](b, &member.Status, nil).
func (InputEnum[M, I, E]) Asc ¶
Asc retains the stored enum operation; Set alone accepts I. Example: members.Status.Asc().
func (InputEnum[M, I, E]) Desc ¶
Desc retains the stored enum operation; Set alone accepts I. Example: members.Status.Desc().
func (InputEnum[M, I, E]) Eq ¶
Eq retains the stored enum operation; Set alone accepts I. Example: members.Status.Eq(StatusActive).
func (InputEnum[M, I, E]) In ¶
In retains the stored enum operation; Set alone accepts I. Example: members.Status.In(StatusActive).
func (InputEnum[M, I, E]) Ne ¶
Ne retains the stored enum operation; Set alone accepts I. Example: members.Status.Ne(StatusActive).
func (InputEnum[M, I, E]) NotIn ¶
NotIn retains the stored enum operation; Set alone accepts I. Example: members.Status.NotIn(StatusActive).
func (InputEnum[M, I, E]) Set ¶
func (c InputEnum[M, I, E]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Status.Set(StatusInput{Value: StatusActive}).
type InputInterval ¶
type InputInterval[M, I any] struct { // contains filtered or unexported fields }
InputInterval accepts I for writes and retains temporal.Interval for stored operations. Example: InputInterval[Booking, PeriodInput].
func InputIntervalOf ¶
func InputIntervalOf[M, I any](b Builder[M], ptr *temporal.Interval, transform func(I) (temporal.Interval, error), opts ...ColumnOption[temporal.Interval]) InputInterval[M, I]
InputIntervalOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputIntervalOf[Booking, PeriodInput](b, &booking.Period, nil).
func (InputInterval[M, I]) Asc ¶
func (c InputInterval[M, I]) Asc() Order[M]
Asc retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Asc().
func (InputInterval[M, I]) Between ¶
func (c InputInterval[M, I]) Between(a, b temporal.Interval) Predicate[M]
Between retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Between(temporal.Days(1), temporal.Days(7)).
func (InputInterval[M, I]) Desc ¶
func (c InputInterval[M, I]) Desc() Order[M]
Desc retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Desc().
func (InputInterval[M, I]) Eq ¶
func (c InputInterval[M, I]) Eq(v temporal.Interval) Predicate[M]
Eq retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Eq(temporal.Days(1)).
func (InputInterval[M, I]) Gt ¶
func (c InputInterval[M, I]) Gt(v temporal.Interval) Predicate[M]
Gt retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Gt(temporal.Days(1)).
func (InputInterval[M, I]) Gte ¶
func (c InputInterval[M, I]) Gte(v temporal.Interval) Predicate[M]
Gte retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Gte(temporal.Days(1)).
func (InputInterval[M, I]) In ¶
func (c InputInterval[M, I]) In(v ...temporal.Interval) Predicate[M]
In retains the stored interval operation; Set alone accepts I. Example: bookings.Period.In(temporal.Days(1)).
func (InputInterval[M, I]) Lt ¶
func (c InputInterval[M, I]) Lt(v temporal.Interval) Predicate[M]
Lt retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Lt(temporal.Days(1)).
func (InputInterval[M, I]) Lte ¶
func (c InputInterval[M, I]) Lte(v temporal.Interval) Predicate[M]
Lte retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Lte(temporal.Days(1)).
func (InputInterval[M, I]) Ne ¶
func (c InputInterval[M, I]) Ne(v temporal.Interval) Predicate[M]
Ne retains the stored interval operation; Set alone accepts I. Example: bookings.Period.Ne(temporal.Days(1)).
func (InputInterval[M, I]) NotIn ¶
func (c InputInterval[M, I]) NotIn(v ...temporal.Interval) Predicate[M]
NotIn retains the stored interval operation; Set alone accepts I. Example: bookings.Period.NotIn(temporal.Days(1)).
func (InputInterval[M, I]) Set ¶
func (c InputInterval[M, I]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: bookings.Period.Set(PeriodInput{Days: 1}).
type InputJSON ¶
InputJSON accepts I for writes and retains value.JSON[T] for stored operations. Example: InputJSON[Member, PreferencesInput, Preferences].
func InputJSONOf ¶
func InputJSONOf[M, I any, T any](b Builder[M], ptr *value.JSON[T], transform func(I) (value.JSON[T], error), opts ...ColumnOption[value.JSON[T]]) InputJSON[M, I, T]
InputJSONOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputJSONOf[Member, PreferencesInput](b, &member.Settings, nil).
func (InputJSON[M, I, T]) Asc ¶
Asc retains the stored json operation; Set alone accepts I. Example: members.Settings.Asc().
func (InputJSON[M, I, T]) ContainedBy ¶
ContainedBy retains the stored json operation; Set alone accepts I. Example: members.Settings.ContainedBy(storedPreferences).
func (InputJSON[M, I, T]) Contains ¶
Contains retains the stored json operation; Set alone accepts I. Example: members.Settings.Contains(storedPreferences).
func (InputJSON[M, I, T]) Desc ¶
Desc retains the stored json operation; Set alone accepts I. Example: members.Settings.Desc().
func (InputJSON[M, I, T]) Eq ¶
Eq retains the stored json operation; Set alone accepts I. Example: members.Settings.Eq(storedPreferences).
func (InputJSON[M, I, T]) In ¶
In retains the stored json operation; Set alone accepts I. Example: members.Settings.In(storedPreferences).
func (InputJSON[M, I, T]) IsJSONNull ¶
IsJSONNull retains the stored json operation; Set alone accepts I. Example: members.Settings.IsJSONNull().
func (InputJSON[M, I, T]) Ne ¶
Ne retains the stored json operation; Set alone accepts I. Example: members.Settings.Ne(storedPreferences).
func (InputJSON[M, I, T]) NotIn ¶
NotIn retains the stored json operation; Set alone accepts I. Example: members.Settings.NotIn(storedPreferences).
func (InputJSON[M, I, T]) Set ¶
func (c InputJSON[M, I, T]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Settings.Set(PreferencesInput{Theme: "dark"}).
type InputKey ¶
type InputKey[M, I any, K comparable] struct { // contains filtered or unexported fields }
InputKey retains stored K for lookup and accepts I for primary-key assignment. Example: InputKey[User, FreshID, model.ID[User]].
func InputKeyOf ¶
func InputKeyOf[M, I any, K comparable](b Builder[M], key Key[M, K], transform func(I) (K, error)) InputKey[M, I, K]
InputKeyOf adds a typed input to the primary key already declared by TableOf. A nil transform selects the matching Mutate<Field> method; distinct inputs disable automatic UUID creation. Call inside Define. Example: InputKeyOf[User, FreshID](b, table.Key(), nil).
func (InputKey[M, I, K]) NotIn ¶
NotIn excludes stored keys. Example: users.ID.NotIn(firstID, secondID).
func (InputKey[M, I, K]) Set ¶
func (c InputKey[M, I, K]) Set(v I) Assignment[M]
Set captures fresh input. Example: users.ID.Set(FreshID{Value: storedID}).
type InputNumber ¶
type InputNumber[M, I any, V NumberValue] struct { // contains filtered or unexported fields }
InputNumber accepts I for writes and retains V for stored operations. Example: InputNumber[Invoice, AmountInput, int64].
func InputNumberOf ¶
func InputNumberOf[M, I any, V NumberValue](b Builder[M], ptr *V, transform func(I) (V, error), opts ...ColumnOption[V]) InputNumber[M, I, V]
InputNumberOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputNumberOf[Invoice, AmountInput](b, &invoice.Amount, nil).
func (InputNumber[M, I, V]) Asc ¶
func (c InputNumber[M, I, V]) Asc() Order[M]
Asc retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Asc().
func (InputNumber[M, I, V]) Between ¶
func (c InputNumber[M, I, V]) Between(a, b V) Predicate[M]
Between retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Between(int64(0), int64(1000)).
func (InputNumber[M, I, V]) Desc ¶
func (c InputNumber[M, I, V]) Desc() Order[M]
Desc retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Desc().
func (InputNumber[M, I, V]) Eq ¶
func (c InputNumber[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Eq(int64(100)).
func (InputNumber[M, I, V]) Gt ¶
func (c InputNumber[M, I, V]) Gt(v V) Predicate[M]
Gt retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Gt(int64(100)).
func (InputNumber[M, I, V]) Gte ¶
func (c InputNumber[M, I, V]) Gte(v V) Predicate[M]
Gte retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Gte(int64(100)).
func (InputNumber[M, I, V]) In ¶
func (c InputNumber[M, I, V]) In(v ...V) Predicate[M]
In retains the stored number operation; Set alone accepts I. Example: invoices.Amount.In(int64(100)).
func (InputNumber[M, I, V]) Lt ¶
func (c InputNumber[M, I, V]) Lt(v V) Predicate[M]
Lt retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Lt(int64(100)).
func (InputNumber[M, I, V]) Lte ¶
func (c InputNumber[M, I, V]) Lte(v V) Predicate[M]
Lte retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Lte(int64(100)).
func (InputNumber[M, I, V]) Ne ¶
func (c InputNumber[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored number operation; Set alone accepts I. Example: invoices.Amount.Ne(int64(100)).
func (InputNumber[M, I, V]) NotIn ¶
func (c InputNumber[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored number operation; Set alone accepts I. Example: invoices.Amount.NotIn(int64(100)).
func (InputNumber[M, I, V]) Set ¶
func (c InputNumber[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: invoices.Amount.Set(AmountInput{Cents: 100}).
type InputText ¶
InputText accepts I for writes and retains V for stored operations. Example: InputText[Member, EmailInput, StoredEmail].
func InputTextOf ¶
func InputTextOf[M, I any, V ~string](b Builder[M], ptr *V, transform func(I) (V, error), opts ...ColumnOption[V]) InputText[M, I, V]
InputTextOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputTextOf[Member, EmailInput](b, &member.Email, nil).
func (InputText[M, I, V]) Asc ¶
Asc retains the stored text operation; Set alone accepts I. Example: members.Email.Asc().
func (InputText[M, I, V]) Between ¶
Between retains the stored text operation; Set alone accepts I. Example: members.Email.Between(StoredEmail("a"), StoredEmail("z")).
func (InputText[M, I, V]) Contains ¶
Contains retains the stored text operation; Set alone accepts I. Example: members.Email.Contains(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Desc ¶
Desc retains the stored text operation; Set alone accepts I. Example: members.Email.Desc().
func (InputText[M, I, V]) EndsWith ¶
EndsWith retains the stored text operation; Set alone accepts I. Example: members.Email.EndsWith(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Eq ¶
Eq retains the stored text operation; Set alone accepts I. Example: members.Email.Eq(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Gt ¶
Gt retains the stored text operation; Set alone accepts I. Example: members.Email.Gt(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Gte ¶
Gte retains the stored text operation; Set alone accepts I. Example: members.Email.Gte(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) IContains ¶
IContains retains the stored text operation; Set alone accepts I. Example: members.Email.IContains(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) IEndsWith ¶
IEndsWith retains the stored text operation; Set alone accepts I. Example: members.Email.IEndsWith(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) ILike ¶
ILike retains the stored text operation; Set alone accepts I. Example: members.Email.ILike(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) IStartsWith ¶
IStartsWith retains the stored text operation; Set alone accepts I. Example: members.Email.IStartsWith(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) In ¶
In retains the stored text operation; Set alone accepts I. Example: members.Email.In(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Like ¶
Like retains the stored text operation; Set alone accepts I. Example: members.Email.Like(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Lt ¶
Lt retains the stored text operation; Set alone accepts I. Example: members.Email.Lt(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Lte ¶
Lte retains the stored text operation; Set alone accepts I. Example: members.Email.Lte(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Ne ¶
Ne retains the stored text operation; Set alone accepts I. Example: members.Email.Ne(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) NotIn ¶
NotIn retains the stored text operation; Set alone accepts I. Example: members.Email.NotIn(StoredEmail("ada@example.test")).
func (InputText[M, I, V]) Set ¶
func (c InputText[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Email.Set(EmailInput{Address: "ada@example.test"}).
func (InputText[M, I, V]) StartsWith ¶
StartsWith retains the stored text operation; Set alone accepts I. Example: members.Email.StartsWith(StoredEmail("ada@example.test")).
type InputTime ¶
InputTime accepts I for writes and retains V for stored operations. Example: InputTime[Event, TimestampInput, time.Time].
func InputTimeOf ¶
func InputTimeOf[M, I any, V TimeValue](b Builder[M], ptr *V, transform func(I) (V, error), opts ...ColumnOption[V]) InputTime[M, I, V]
InputTimeOf binds a distinct input. A nil transform selects the model Mutate method. Example: InputTimeOf[Event, TimestampInput](b, &event.StartsAt, nil).
func (InputTime[M, I, V]) Asc ¶
Asc retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Asc().
func (InputTime[M, I, V]) Between ¶
Between retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Between(startsAt, endsAt).
func (InputTime[M, I, V]) Desc ¶
Desc retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Desc().
func (InputTime[M, I, V]) Eq ¶
Eq retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Eq(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Gt ¶
Gt retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Gt(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Gte ¶
Gte retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Gte(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) In ¶
In retains the stored time operation; Set alone accepts I. Example: events.StartsAt.In(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Lt ¶
Lt retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Lt(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Lte ¶
Lte retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Lte(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Ne ¶
Ne retains the stored time operation; Set alone accepts I. Example: events.StartsAt.Ne(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) NotIn ¶
NotIn retains the stored time operation; Set alone accepts I. Example: events.StartsAt.NotIn(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (InputTime[M, I, V]) Set ¶
func (c InputTime[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: events.StartsAt.Set(TimestampInput{Time: startsAt}).
type InsertMapping ¶
type InsertMapping[S, M any] struct { // contains filtered or unexported fields }
InsertMapping maps one exact stored source value. Example: rows.MapInsert(Archives.Name,expr.Value(Users.Name)).
func FoundryInsertMapping ¶
func FoundryInsertMapping[S, M any](m ormcore.ModelMapping, seal sqlowner.ExpressionSeal) InsertMapping[S, M]
FoundryInsertMapping binds a framework expression to its destination. Example: FoundryInsertMapping[User,Archive](mapping,sqlowner.Expressions()).
type InsertSelect ¶
type InsertSelect[S, M any] struct { // contains filtered or unexported fields }
InsertSelect inserts a complete source window without per-model callbacks. Example: rows.InsertFrom(rows.From(Users.Query()),Archives.Query()).
func FoundryInsertFrom ¶
func FoundryInsertFrom[S, M any](q Query[M], source ormcore.Source, seal sqlowner.QuerySeal) InsertSelect[S, M]
FoundryInsertFrom creates a source insertion plan. Example: FoundryInsertFrom[User](Archives.Query(),source,sqlowner.Queries()).
func (InsertSelect[S, M]) Exec ¶
func (p InsertSelect[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
Exec returns the affected count without collecting models. Example: plan.Exec(ctx,db).
func (InsertSelect[S, M]) Format ¶
func (InsertSelect[S, M]) Format(s fmt.State, _ rune)
Format hides captured source values. Example: fmt.Sprintf("%#v",plan).
func (InsertSelect[S, M]) Returning ¶
func (p InsertSelect[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
Returning collects at most limit complete models; overflow rolls back, never truncates. Example: plan.Returning(ctx,db,100).
func (InsertSelect[S, M]) Select ¶
func (p InsertSelect[S, M]) Select(mappings ...InsertMapping[S, M]) InsertSelect[S, M]
Select appends mappings; duplicates and overlap with Values are rejected. Example: plan.Select(rows.MapInsert(Archives.Name,expr.Value(Users.Name))).
func (InsertSelect[S, M]) Values ¶
func (p InsertSelect[S, M]) Values(values ...Assignment[M]) InsertSelect[S, M]
Values replaces literal inputs, normalized once per statement. Example: plan.Values(Archives.Tag.Set(input)).
type InsertTarget ¶
type InsertTarget[M, V, P any] interface { ExpressionColumn[M, V, P] ordinaryLayouts[M, V] | createdLayouts[M, V] | primaryLayouts[M, V] }
InsertTarget admits unmutated stored assignments, creation timestamps and declared primary mappings. Example: rows.MapInsert(Archives.ID, expr.Value(Users.ID)).
type InstantValue ¶
InstantValue permits managed timestamp fields. Example: CreatedAtOf(b, &o.CreatedAt).
type Interval ¶
type Interval[M any] struct { // contains filtered or unexported fields }
Interval supports ordered interval predicates and assignments, retaining calendar components. PostgreSQL compares using 30-day months and 24-hour days: Eq(temporal.Months(1)) also matches 30 days. Hydration preserves distinct calendar and elapsed components. Example: Records.Period.Gt(temporal.Days(1)).
func IntervalOf ¶
func IntervalOf[M any](b Builder[M], ptr *temporal.Interval, opts ...ColumnOption[temporal.Interval]) Interval[M]
IntervalOf binds an interval without enabling numeric adjustments or text patterns. Example: IntervalOf(b, &m.Period).
func (Interval[M]) Between ¶
Between includes both endpoints. Example: Records.Period.Between(a, b).
type JSON ¶
type JSON[M, T any] struct { // contains filtered or unexported fields }
JSON binds a typed JSON document with sorting but without range comparisons or text patterns. Example: Records.Settings.Eq(settings).
func JSONOf ¶
func JSONOf[M, T any](b Builder[M], ptr *value.JSON[T], opts ...ColumnOption[value.JSON[T]]) JSON[M, T]
JSONOf binds immutable typed JSON through its existing codec. Example: JSONOf(b,&m.Settings).
func (JSON[M, T]) ContainedBy ¶
ContainedBy tests the reverse JSONB containment. Example: Records.Settings.ContainedBy(settings).
func (JSON[M, T]) Contains ¶
Contains tests JSONB document containment, not a text pattern. Example: Records.Settings.Contains(settings).
func (JSON[M, T]) IsJSONNull ¶
IsJSONNull matches a JSON null document, excluding SQL NULL. Example: Records.Settings.IsJSONNull().
type Key ¶
type Key[M any, K comparable] = keyColumn[M, K, lookupKeyRole]
Key identifies a table's primary column. Example: Orders.Key().Eq(id).
type KeyColumn ¶
type KeyColumn[M any, K comparable] interface { // contains filtered or unexported methods }
KeyColumn retains comparable relation key types, including nullable FKs. Example: BelongsToOf(Orders.Buyer,Orders.BuyerID,Users.ID).
type KeyLookup ¶
type KeyLookup[M any, K comparable] struct { // contains filtered or unexported fields }
KeyLookup retains a filtered declaration and a typed lookup key. Example: orm.Keyed(Users.Query(),Users.Key()).Find(ctx,db,id).
func Keyed ¶
func Keyed[M any, K comparable](q Query[M], key Key[M, K]) KeyLookup[M, K]
Keyed retains filters, eager loads, soft-delete scope and retrieval hooks. Example: modelbinding.ByKey(db,orm.Keyed(Users.Query(),Users.Key()),pathKey).
func Unique ¶
func Unique[M any, K comparable](q Query[M], field KeyColumn[M, K]) KeyLookup[M, K]
Unique binds a stored alternate key, rejecting a second matching row. Example: orm.Unique(Users.Query(),Users.Email).Find(ctx,db,email).
func (KeyLookup[M, K]) Find ¶
func (l KeyLookup[M, K]) Find(ctx context.Context, ex database.Executor, key K) (value.Optional[M], error)
Find performs one parameterized SELECT; only unique results receive eager loads. Example: lookup.Find(ctx,db,key).
func (KeyLookup[M, K]) Format ¶
Format redacts scope literals and model metadata. Example: fmt.Sprintf("%+v", lookup).
func (KeyLookup[M, K]) GoString ¶
GoString redacts Go-syntax diagnostics. Example: fmt.Sprintf("%#v", lookup).
type LockedQuery ¶
type LockedQuery[M any] struct { // contains filtered or unexported fields }
LockedQuery requires a transaction for every terminal. Example: Orders.Query().ForUpdate().All(ctx,tx).
func (LockedQuery[M]) All ¶
All reads locked rows within a transaction. Example: Orders.Query().ForUpdate().All(ctx,tx).
func (LockedQuery[M]) First ¶
First reads at most one locked row. Example: Orders.Query().ForShare().First(ctx,tx).
func (LockedQuery[M]) Limit ¶
func (q LockedQuery[M]) Limit(n int) LockedQuery[M]
Limit bounds locked rows.
func (LockedQuery[M]) NoWait ¶
func (q LockedQuery[M]) NoWait() LockedQuery[M]
NoWait fails instead of waiting for conflicting locks.
func (LockedQuery[M]) Offset ¶
func (q LockedQuery[M]) Offset(n int) LockedQuery[M]
Offset skips matching rows before locking.
func (LockedQuery[M]) OnlyTrashed ¶
func (q LockedQuery[M]) OnlyTrashed() LockedQuery[M]
OnlyTrashed selects deleted rows.
func (LockedQuery[M]) OrderBy ¶
func (q LockedQuery[M]) OrderBy(os ...Order[M]) LockedQuery[M]
OrderBy appends locked-row ordering.
func (LockedQuery[M]) Require ¶
Require reads one locked row or fails. Example: Orders.Query().ForUpdate().Require(ctx,tx).
func (LockedQuery[M]) SkipLocked ¶
func (q LockedQuery[M]) SkipLocked() LockedQuery[M]
SkipLocked skips rows held by conflicting locks.
func (LockedQuery[M]) Wait ¶
func (q LockedQuery[M]) Wait() LockedQuery[M]
Wait restores the default waiting behavior.
func (LockedQuery[M]) Where ¶
func (q LockedQuery[M]) Where(ps ...Predicate[M]) LockedQuery[M]
Where adds conditions to a locked query.
func (LockedQuery[M]) WithTrashed ¶
func (q LockedQuery[M]) WithTrashed() LockedQuery[M]
WithTrashed includes deleted rows.
func (LockedQuery[M]) WithoutTrashed ¶
func (q LockedQuery[M]) WithoutTrashed() LockedQuery[M]
WithoutTrashed selects active rows.
type Many ¶
type Many[M, N any] struct { // contains filtered or unexported fields }
Many identifies a collection slot. Example: Orders Many[User,Order].
type ModelIdentity ¶
type ModelIdentity[M any, K comparable] struct { // contains filtered or unexported fields }
ModelIdentity retains a declaration's concrete primary key without model methods. Identity reads select keys only and do not run retrieval hooks. Example: orm.IdentityOf(Users.Table, Users.Key()).
func IdentityOf ¶
func IdentityOf[M any, K comparable](table Table[M, K], key Key[M, K]) ModelIdentity[M, K]
IdentityOf binds the model's own primary handle. Example: orm.IdentityOf(Users.Table, Users.Key()).
func (ModelIdentity[M, K]) ActiveKeys ¶
func (d ModelIdentity[M, K]) ActiveKeys(ctx context.Context, ex database.Executor, keys []K) ([]K, error)
ActiveKeys selects currently visible keys in one bounded statement. Example: identity.ActiveKeys(ctx,db,ids).
func (ModelIdentity[M, K]) KeyToken ¶
func (d ModelIdentity[M, K]) KeyToken(key K) (string, error)
KeyToken preserves SQL equality canonicalization for extension storage. Example: identity.KeyToken(id).
func (ModelIdentity[M, K]) LockActive ¶
LockActive locks one visible owner in the caller's transaction. Example: identity.LockActive(ctx,tx,id).
func (ModelIdentity[M, K]) ModelName ¶
func (d ModelIdentity[M, K]) ModelName() string
ModelName returns the persisted table name. Example: identity.ModelName().
func (ModelIdentity[M, K]) Parse ¶
Parse restores a reference with the same model and codec. Example: identity.Parse(stored).
func (ModelIdentity[M, K]) Reference ¶
func (d ModelIdentity[M, K]) Reference(key K) model.Reference[M, K]
Reference builds a typed reference using the stored key codec. Example: identity.Reference(id).
func (ModelIdentity[M, K]) ReferenceOf ¶
func (d ModelIdentity[M, K]) ReferenceOf(m M) model.Reference[M, K]
ReferenceOf reads the model's stored primary key without I/O. Example: identity.ReferenceOf(user).
func (ModelIdentity[M, K]) RetainedKeys ¶
func (d ModelIdentity[M, K]) RetainedKeys(ctx context.Context, ex database.Executor, keys []K) ([]K, error)
RetainedKeys includes soft-deleted owners for orphan inspection. Example: identity.RetainedKeys(ctx,db,ids).
func (ModelIdentity[M, K]) Scope ¶
func (d ModelIdentity[M, K]) Scope(keys ...K) Predicate[M]
Scope retains model and key ownership for bounded membership. Example: Users.Query().Where(identity.Scope(ids...)).
func (ModelIdentity[M, K]) Validate ¶
func (d ModelIdentity[M, K]) Validate() error
Validate rejects zero declarations and keys from another declaration. Example: identity.Validate().
type NullableColumn ¶
type NullableColumn[M, V any] struct { // contains filtered or unexported fields }
NullableColumn exposes explicit NULL. Example: Users.IntroducerID.SetNull().
func NullableBytesOf ¶
func NullableBytesOf[M any, V ~[]byte](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableColumn[M, V]
NullableBytesOf binds nullable binary values. Example: NullableBytesOf(b,&o.Payload).
func NullableColumnOf ¶
func NullableColumnOf[M, V any](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableColumn[M, V]
NullableColumnOf binds nullable scalar values. Example: NullableColumnOf(b,&o.IntroducerID).
func NullableIDOf ¶
func NullableIDOf[M, T any](b Builder[M], ptr *value.Nullable[model.ID[T]]) NullableColumn[M, model.ID[T]]
NullableIDOf declares a nullable model-owned ID. Example: NullableIDOf(b, &u.IntroducerID).
func NullablePasswordOf ¶
func NullablePasswordOf[M any](b Builder[M], ptr *value.Nullable[password.Hash]) NullableColumn[M, password.Hash]
NullablePasswordOf adds SQL NULL operations to a sensitive stored hash. Example: Accounts.Backup.SetNull().
func (NullableColumn[M, V]) Asc ¶
func (c NullableColumn[M, V]) Asc() Order[M]
Asc sorts ascending. Example: Users.IntroducerID.Asc().
func (NullableColumn[M, V]) Desc ¶
func (c NullableColumn[M, V]) Desc() Order[M]
Desc sorts descending. Example: Users.IntroducerID.Desc().
func (NullableColumn[M, V]) Eq ¶
func (c NullableColumn[M, V]) Eq(v V) Predicate[M]
Eq compares a concrete value. Example: Users.IntroducerID.Eq(userID).
func (NullableColumn[M, V]) In ¶
func (c NullableColumn[M, V]) In(v ...V) Predicate[M]
In tests membership. Example: Users.IntroducerID.In(a, b).
func (NullableColumn[M, V]) IsNotNull ¶
func (c NullableColumn[M, V]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: Users.IntroducerID.IsNotNull().
func (NullableColumn[M, V]) IsNull ¶
func (c NullableColumn[M, V]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: Users.IntroducerID.IsNull().
func (NullableColumn[M, V]) Ne ¶
func (c NullableColumn[M, V]) Ne(v V) Predicate[M]
Ne excludes a concrete value. Example: Users.IntroducerID.Ne(userID).
func (NullableColumn[M, V]) NotIn ¶
func (c NullableColumn[M, V]) NotIn(v ...V) Predicate[M]
NotIn excludes membership. Example: Users.IntroducerID.NotIn(a, b).
func (NullableColumn[M, V]) Set ¶
func (c NullableColumn[M, V]) Set(v V) Assignment[M]
Set assigns a value, including zero. Example: Users.IntroducerID.Set(userID).
func (NullableColumn[M, V]) SetNull ¶
func (c NullableColumn[M, V]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: Users.IntroducerID.SetNull().
type NullableEncrypted ¶
type NullableEncrypted[M any, V encrypted.Value[V]] struct { // contains filtered or unexported fields }
NullableEncrypted adds only SQL NULL predicates and assignments. Example: Vaults.Backup.IsNull().
func NullableEncryptedJSONOf ¶
func NullableEncryptedJSONOf[M, T any](b Builder[M], ptr *value.Nullable[encrypted.JSON[T]]) NullableEncrypted[M, encrypted.JSON[T]]
NullableEncryptedJSONOf adds SQL NULL to encrypted JSON. Example: NullableEncryptedJSONOf(b,&m.BackupSettings).
func NullableEncryptedTextOf ¶
func NullableEncryptedTextOf[M any](b Builder[M], ptr *value.Nullable[encrypted.Text]) NullableEncrypted[M, encrypted.Text]
NullableEncryptedTextOf adds SQL NULL to encrypted text. Example: NullableEncryptedTextOf(b,&m.Backup).
func (NullableEncrypted[M, V]) IsNotNull ¶
func (c NullableEncrypted[M, V]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL without comparing ciphertext. Example: Vaults.Backup.IsNotNull().
func (NullableEncrypted[M, V]) IsNull ¶
func (c NullableEncrypted[M, V]) IsNull() Predicate[M]
IsNull matches SQL NULL without comparing ciphertext. Example: Vaults.Backup.IsNull().
func (NullableEncrypted[M, V]) Set ¶
func (c NullableEncrypted[M, V]) Set(v V) Assignment[M]
Set captures a present encrypted value. Example: Vaults.Backup.Set(encrypted.NewText("private")).
func (NullableEncrypted[M, V]) SetNull ¶
func (c NullableEncrypted[M, V]) SetNull() Assignment[M]
SetNull clears the encrypted column inside a keyed write. Example: Vaults.Backup.SetNull().
type NullableEnum ¶
NullableEnum exposes nullable enums. Example: records.Status.SetNull().
func NullableEnumOf ¶
func NullableEnumOf[M any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }](b Builder[M], ptr *value.Nullable[E], opts ...ColumnOption[E]) NullableEnum[M, E]
NullableEnumOf binds nullable enums. Example: NullableEnumOf(b,&o.Status).
func (NullableEnum[M, E]) Asc ¶
func (c NullableEnum[M, E]) Asc() Order[M]
Asc sorts ascending. Example: optionalStatus.Asc() (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) Desc ¶
func (c NullableEnum[M, E]) Desc() Order[M]
Desc sorts descending. Example: optionalStatus.Desc() (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) Eq ¶
func (c NullableEnum[M, E]) Eq(v E) Predicate[M]
Eq compares a concrete value. Example: optionalStatus.Eq(StatusActive) (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) In ¶
func (c NullableEnum[M, E]) In(v ...E) Predicate[M]
In tests membership. Example: optionalStatus.In(a, b) (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) IsNotNull ¶
func (c NullableEnum[M, E]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: optionalStatus.IsNotNull() (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) IsNull ¶
func (c NullableEnum[M, E]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: optionalStatus.IsNull() (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) Ne ¶
func (c NullableEnum[M, E]) Ne(v E) Predicate[M]
Ne excludes a concrete value. Example: optionalStatus.Ne(StatusActive) (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) NotIn ¶
func (c NullableEnum[M, E]) NotIn(v ...E) Predicate[M]
NotIn excludes membership. Example: optionalStatus.NotIn(a, b) (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) Set ¶
func (c NullableEnum[M, E]) Set(v E) Assignment[M]
Set assigns a value, including zero. Example: optionalStatus.Set(StatusActive) (optionalStatus is orm.NullableEnum[User, Status]).
func (NullableEnum[M, E]) SetNull ¶
func (c NullableEnum[M, E]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: optionalStatus.SetNull() (optionalStatus is orm.NullableEnum[User, Status]).
type NullableInputColumn ¶
NullableInputColumn accepts I for writes and retains V for stored operations. Example: NullableInputColumn[Member, LabelInput, StoredLabel].
func NullableInputBytesOf ¶
func NullableInputBytesOf[M, I any, V ~[]byte](b Builder[M], ptr *value.Nullable[V], transform func(I) (V, error)) NullableInputColumn[M, I, V]
NullableInputBytesOf binds owned stored bytes and a concrete input. Example: NullableInputBytesOf[Document, BodyInput](b, &document.Body, encodeBody).
func NullableInputColumnOf ¶
func NullableInputColumnOf[M, I any, V any](b Builder[M], ptr *value.Nullable[V], transform func(I) (V, error), opts ...ColumnOption[V]) NullableInputColumn[M, I, V]
NullableInputColumnOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputColumnOf[Member, LabelInput](b, &member.Note, nil).
func (NullableInputColumn[M, I, V]) Asc ¶
func (c NullableInputColumn[M, I, V]) Asc() Order[M]
Asc retains the stored column operation; Set alone accepts I. Example: members.Note.Asc().
func (NullableInputColumn[M, I, V]) Desc ¶
func (c NullableInputColumn[M, I, V]) Desc() Order[M]
Desc retains the stored column operation; Set alone accepts I. Example: members.Note.Desc().
func (NullableInputColumn[M, I, V]) Eq ¶
func (c NullableInputColumn[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored column operation; Set alone accepts I. Example: members.Note.Eq(StoredLabel("ada@example.test")).
func (NullableInputColumn[M, I, V]) In ¶
func (c NullableInputColumn[M, I, V]) In(v ...V) Predicate[M]
In retains the stored column operation; Set alone accepts I. Example: members.Note.In(StoredLabel("ada@example.test")).
func (NullableInputColumn[M, I, V]) IsNotNull ¶
func (c NullableInputColumn[M, I, V]) IsNotNull() Predicate[M]
IsNotNull retains the stored column operation; Set alone accepts I. Example: members.Note.IsNotNull().
func (NullableInputColumn[M, I, V]) IsNull ¶
func (c NullableInputColumn[M, I, V]) IsNull() Predicate[M]
IsNull retains the stored column operation; Set alone accepts I. Example: members.Note.IsNull().
func (NullableInputColumn[M, I, V]) Ne ¶
func (c NullableInputColumn[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored column operation; Set alone accepts I. Example: members.Note.Ne(StoredLabel("ada@example.test")).
func (NullableInputColumn[M, I, V]) NotIn ¶
func (c NullableInputColumn[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored column operation; Set alone accepts I. Example: members.Note.NotIn(StoredLabel("ada@example.test")).
func (NullableInputColumn[M, I, V]) Set ¶
func (c NullableInputColumn[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Note.Set(LabelInput{Text: "ada@example.test"}).
func (NullableInputColumn[M, I, V]) SetNull ¶
func (c NullableInputColumn[M, I, V]) SetNull() Assignment[M]
SetNull retains the stored column operation; Set alone accepts I. Example: members.Note.SetNull().
type NullableInputEnum ¶
type NullableInputEnum[M, I any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }] struct { // contains filtered or unexported fields }
NullableInputEnum accepts I for writes and retains E for stored operations. Example: NullableInputEnum[Member, StatusInput, Status].
func NullableInputEnumOf ¶
func NullableInputEnumOf[M, I any, E interface { enum.Scalar EnumDescriptor() enum.Descriptor[E] }](b Builder[M], ptr *value.Nullable[E], transform func(I) (E, error), opts ...ColumnOption[E]) NullableInputEnum[M, I, E]
NullableInputEnumOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputEnumOf[Member, StatusInput](b, &member.Status, nil).
func (NullableInputEnum[M, I, E]) Asc ¶
func (c NullableInputEnum[M, I, E]) Asc() Order[M]
Asc retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.Asc().
func (NullableInputEnum[M, I, E]) Desc ¶
func (c NullableInputEnum[M, I, E]) Desc() Order[M]
Desc retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.Desc().
func (NullableInputEnum[M, I, E]) Eq ¶
func (c NullableInputEnum[M, I, E]) Eq(v E) Predicate[M]
Eq retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.Eq(StatusActive).
func (NullableInputEnum[M, I, E]) In ¶
func (c NullableInputEnum[M, I, E]) In(v ...E) Predicate[M]
In retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.In(StatusActive).
func (NullableInputEnum[M, I, E]) IsNotNull ¶
func (c NullableInputEnum[M, I, E]) IsNotNull() Predicate[M]
IsNotNull retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.IsNotNull().
func (NullableInputEnum[M, I, E]) IsNull ¶
func (c NullableInputEnum[M, I, E]) IsNull() Predicate[M]
IsNull retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.IsNull().
func (NullableInputEnum[M, I, E]) Ne ¶
func (c NullableInputEnum[M, I, E]) Ne(v E) Predicate[M]
Ne retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.Ne(StatusActive).
func (NullableInputEnum[M, I, E]) NotIn ¶
func (c NullableInputEnum[M, I, E]) NotIn(v ...E) Predicate[M]
NotIn retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.NotIn(StatusActive).
func (NullableInputEnum[M, I, E]) Set ¶
func (c NullableInputEnum[M, I, E]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.OptionalStatus.Set(StatusInput{Value: StatusActive}).
func (NullableInputEnum[M, I, E]) SetNull ¶
func (c NullableInputEnum[M, I, E]) SetNull() Assignment[M]
SetNull retains the stored enum operation; Set alone accepts I. Example: members.OptionalStatus.SetNull().
type NullableInputInterval ¶
type NullableInputInterval[M, I any] struct { // contains filtered or unexported fields }
NullableInputInterval accepts I for writes and retains temporal.Interval for stored operations. Example: NullableInputInterval[Booking, PeriodInput].
func NullableInputIntervalOf ¶
func NullableInputIntervalOf[M, I any](b Builder[M], ptr *value.Nullable[temporal.Interval], transform func(I) (temporal.Interval, error), opts ...ColumnOption[temporal.Interval]) NullableInputInterval[M, I]
NullableInputIntervalOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputIntervalOf[Booking, PeriodInput](b, &booking.Period, nil).
func (NullableInputInterval[M, I]) Asc ¶
func (c NullableInputInterval[M, I]) Asc() Order[M]
Asc retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Asc().
func (NullableInputInterval[M, I]) Between ¶
func (c NullableInputInterval[M, I]) Between(a, b temporal.Interval) Predicate[M]
Between retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Between(temporal.Days(1), temporal.Days(7)).
func (NullableInputInterval[M, I]) Desc ¶
func (c NullableInputInterval[M, I]) Desc() Order[M]
Desc retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Desc().
func (NullableInputInterval[M, I]) Eq ¶
func (c NullableInputInterval[M, I]) Eq(v temporal.Interval) Predicate[M]
Eq retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Eq(temporal.Days(1)).
func (NullableInputInterval[M, I]) Gt ¶
func (c NullableInputInterval[M, I]) Gt(v temporal.Interval) Predicate[M]
Gt retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Gt(temporal.Days(1)).
func (NullableInputInterval[M, I]) Gte ¶
func (c NullableInputInterval[M, I]) Gte(v temporal.Interval) Predicate[M]
Gte retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Gte(temporal.Days(1)).
func (NullableInputInterval[M, I]) In ¶
func (c NullableInputInterval[M, I]) In(v ...temporal.Interval) Predicate[M]
In retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.In(temporal.Days(1)).
func (NullableInputInterval[M, I]) IsNotNull ¶
func (c NullableInputInterval[M, I]) IsNotNull() Predicate[M]
IsNotNull retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.IsNotNull().
func (NullableInputInterval[M, I]) IsNull ¶
func (c NullableInputInterval[M, I]) IsNull() Predicate[M]
IsNull retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.IsNull().
func (NullableInputInterval[M, I]) Lt ¶
func (c NullableInputInterval[M, I]) Lt(v temporal.Interval) Predicate[M]
Lt retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Lt(temporal.Days(1)).
func (NullableInputInterval[M, I]) Lte ¶
func (c NullableInputInterval[M, I]) Lte(v temporal.Interval) Predicate[M]
Lte retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Lte(temporal.Days(1)).
func (NullableInputInterval[M, I]) Ne ¶
func (c NullableInputInterval[M, I]) Ne(v temporal.Interval) Predicate[M]
Ne retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.Ne(temporal.Days(1)).
func (NullableInputInterval[M, I]) NotIn ¶
func (c NullableInputInterval[M, I]) NotIn(v ...temporal.Interval) Predicate[M]
NotIn retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.NotIn(temporal.Days(1)).
func (NullableInputInterval[M, I]) Set ¶
func (c NullableInputInterval[M, I]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: bookings.OptionalPeriod.Set(PeriodInput{Days: 1}).
func (NullableInputInterval[M, I]) SetNull ¶
func (c NullableInputInterval[M, I]) SetNull() Assignment[M]
SetNull retains the stored interval operation; Set alone accepts I. Example: bookings.OptionalPeriod.SetNull().
type NullableInputJSON ¶
NullableInputJSON accepts I for writes and retains value.JSON[T] for stored operations. Example: NullableInputJSON[Member, PreferencesInput, Preferences].
func NullableInputJSONOf ¶
func NullableInputJSONOf[M, I any, T any](b Builder[M], ptr *value.Nullable[value.JSON[T]], transform func(I) (value.JSON[T], error), opts ...ColumnOption[value.JSON[T]]) NullableInputJSON[M, I, T]
NullableInputJSONOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputJSONOf[Member, PreferencesInput](b, &member.Settings, nil).
func (NullableInputJSON[M, I, T]) Asc ¶
func (c NullableInputJSON[M, I, T]) Asc() Order[M]
Asc retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.Asc().
func (NullableInputJSON[M, I, T]) ContainedBy ¶
func (c NullableInputJSON[M, I, T]) ContainedBy(v value.JSON[T]) Predicate[M]
ContainedBy retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.ContainedBy(storedPreferences).
func (NullableInputJSON[M, I, T]) Contains ¶
func (c NullableInputJSON[M, I, T]) Contains(v value.JSON[T]) Predicate[M]
Contains retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.Contains(storedPreferences).
func (NullableInputJSON[M, I, T]) Desc ¶
func (c NullableInputJSON[M, I, T]) Desc() Order[M]
Desc retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.Desc().
func (NullableInputJSON[M, I, T]) Eq ¶
func (c NullableInputJSON[M, I, T]) Eq(v value.JSON[T]) Predicate[M]
Eq retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.Eq(storedPreferences).
func (NullableInputJSON[M, I, T]) In ¶
func (c NullableInputJSON[M, I, T]) In(v ...value.JSON[T]) Predicate[M]
In retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.In(storedPreferences).
func (NullableInputJSON[M, I, T]) IsJSONNull ¶
func (c NullableInputJSON[M, I, T]) IsJSONNull() Predicate[M]
IsJSONNull retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.IsJSONNull().
func (NullableInputJSON[M, I, T]) IsNotNull ¶
func (c NullableInputJSON[M, I, T]) IsNotNull() Predicate[M]
IsNotNull retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.IsNotNull().
func (NullableInputJSON[M, I, T]) IsNull ¶
func (c NullableInputJSON[M, I, T]) IsNull() Predicate[M]
IsNull retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.IsNull().
func (NullableInputJSON[M, I, T]) Ne ¶
func (c NullableInputJSON[M, I, T]) Ne(v value.JSON[T]) Predicate[M]
Ne retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.Ne(storedPreferences).
func (NullableInputJSON[M, I, T]) NotIn ¶
func (c NullableInputJSON[M, I, T]) NotIn(v ...value.JSON[T]) Predicate[M]
NotIn retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.NotIn(storedPreferences).
func (NullableInputJSON[M, I, T]) Set ¶
func (c NullableInputJSON[M, I, T]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.BackupSettings.Set(PreferencesInput{Theme: "dark"}).
func (NullableInputJSON[M, I, T]) SetNull ¶
func (c NullableInputJSON[M, I, T]) SetNull() Assignment[M]
SetNull retains the stored json operation; Set alone accepts I. Example: members.BackupSettings.SetNull().
type NullableInputNumber ¶
type NullableInputNumber[M, I any, V NumberValue] struct { // contains filtered or unexported fields }
NullableInputNumber accepts I for writes and retains V for stored operations. Example: NullableInputNumber[Invoice, AmountInput, int64].
func NullableInputNumberOf ¶
func NullableInputNumberOf[M, I any, V NumberValue](b Builder[M], ptr *value.Nullable[V], transform func(I) (V, error), opts ...ColumnOption[V]) NullableInputNumber[M, I, V]
NullableInputNumberOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputNumberOf[Invoice, AmountInput](b, &invoice.Amount, nil).
func (NullableInputNumber[M, I, V]) Asc ¶
func (c NullableInputNumber[M, I, V]) Asc() Order[M]
Asc retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Asc().
func (NullableInputNumber[M, I, V]) Between ¶
func (c NullableInputNumber[M, I, V]) Between(a, b V) Predicate[M]
Between retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Between(int64(0), int64(1000)).
func (NullableInputNumber[M, I, V]) Desc ¶
func (c NullableInputNumber[M, I, V]) Desc() Order[M]
Desc retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Desc().
func (NullableInputNumber[M, I, V]) Eq ¶
func (c NullableInputNumber[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Eq(int64(100)).
func (NullableInputNumber[M, I, V]) Gt ¶
func (c NullableInputNumber[M, I, V]) Gt(v V) Predicate[M]
Gt retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Gt(int64(100)).
func (NullableInputNumber[M, I, V]) Gte ¶
func (c NullableInputNumber[M, I, V]) Gte(v V) Predicate[M]
Gte retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Gte(int64(100)).
func (NullableInputNumber[M, I, V]) In ¶
func (c NullableInputNumber[M, I, V]) In(v ...V) Predicate[M]
In retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.In(int64(100)).
func (NullableInputNumber[M, I, V]) IsNotNull ¶
func (c NullableInputNumber[M, I, V]) IsNotNull() Predicate[M]
IsNotNull retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.IsNotNull().
func (NullableInputNumber[M, I, V]) IsNull ¶
func (c NullableInputNumber[M, I, V]) IsNull() Predicate[M]
IsNull retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.IsNull().
func (NullableInputNumber[M, I, V]) Lt ¶
func (c NullableInputNumber[M, I, V]) Lt(v V) Predicate[M]
Lt retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Lt(int64(100)).
func (NullableInputNumber[M, I, V]) Lte ¶
func (c NullableInputNumber[M, I, V]) Lte(v V) Predicate[M]
Lte retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Lte(int64(100)).
func (NullableInputNumber[M, I, V]) Ne ¶
func (c NullableInputNumber[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.Ne(int64(100)).
func (NullableInputNumber[M, I, V]) NotIn ¶
func (c NullableInputNumber[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.NotIn(int64(100)).
func (NullableInputNumber[M, I, V]) Set ¶
func (c NullableInputNumber[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: invoices.OptionalAmount.Set(AmountInput{Cents: 100}).
func (NullableInputNumber[M, I, V]) SetNull ¶
func (c NullableInputNumber[M, I, V]) SetNull() Assignment[M]
SetNull retains the stored number operation; Set alone accepts I. Example: invoices.OptionalAmount.SetNull().
type NullableInputText ¶
NullableInputText accepts I for writes and retains V for stored operations. Example: NullableInputText[Member, LabelInput, StoredLabel].
func NullableInputTextOf ¶
func NullableInputTextOf[M, I any, V ~string](b Builder[M], ptr *value.Nullable[V], transform func(I) (V, error), opts ...ColumnOption[V]) NullableInputText[M, I, V]
NullableInputTextOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputTextOf[Member, LabelInput](b, &member.Note, nil).
func (NullableInputText[M, I, V]) Asc ¶
func (c NullableInputText[M, I, V]) Asc() Order[M]
Asc retains the stored text operation; Set alone accepts I. Example: members.Note.Asc().
func (NullableInputText[M, I, V]) Between ¶
func (c NullableInputText[M, I, V]) Between(a, b V) Predicate[M]
Between retains the stored text operation; Set alone accepts I. Example: members.Note.Between(StoredLabel("a"), StoredLabel("z")).
func (NullableInputText[M, I, V]) Contains ¶
func (c NullableInputText[M, I, V]) Contains(v V) Predicate[M]
Contains retains the stored text operation; Set alone accepts I. Example: members.Note.Contains(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Desc ¶
func (c NullableInputText[M, I, V]) Desc() Order[M]
Desc retains the stored text operation; Set alone accepts I. Example: members.Note.Desc().
func (NullableInputText[M, I, V]) EndsWith ¶
func (c NullableInputText[M, I, V]) EndsWith(v V) Predicate[M]
EndsWith retains the stored text operation; Set alone accepts I. Example: members.Note.EndsWith(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Eq ¶
func (c NullableInputText[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored text operation; Set alone accepts I. Example: members.Note.Eq(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Gt ¶
func (c NullableInputText[M, I, V]) Gt(v V) Predicate[M]
Gt retains the stored text operation; Set alone accepts I. Example: members.Note.Gt(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Gte ¶
func (c NullableInputText[M, I, V]) Gte(v V) Predicate[M]
Gte retains the stored text operation; Set alone accepts I. Example: members.Note.Gte(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) IContains ¶
func (c NullableInputText[M, I, V]) IContains(v V) Predicate[M]
IContains retains the stored text operation; Set alone accepts I. Example: members.Note.IContains(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) IEndsWith ¶
func (c NullableInputText[M, I, V]) IEndsWith(v V) Predicate[M]
IEndsWith retains the stored text operation; Set alone accepts I. Example: members.Note.IEndsWith(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) ILike ¶
func (c NullableInputText[M, I, V]) ILike(v V) Predicate[M]
ILike retains the stored text operation; Set alone accepts I. Example: members.Note.ILike(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) IStartsWith ¶
func (c NullableInputText[M, I, V]) IStartsWith(v V) Predicate[M]
IStartsWith retains the stored text operation; Set alone accepts I. Example: members.Note.IStartsWith(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) In ¶
func (c NullableInputText[M, I, V]) In(v ...V) Predicate[M]
In retains the stored text operation; Set alone accepts I. Example: members.Note.In(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) IsNotNull ¶
func (c NullableInputText[M, I, V]) IsNotNull() Predicate[M]
IsNotNull retains the stored text operation; Set alone accepts I. Example: members.Note.IsNotNull().
func (NullableInputText[M, I, V]) IsNull ¶
func (c NullableInputText[M, I, V]) IsNull() Predicate[M]
IsNull retains the stored text operation; Set alone accepts I. Example: members.Note.IsNull().
func (NullableInputText[M, I, V]) Like ¶
func (c NullableInputText[M, I, V]) Like(v V) Predicate[M]
Like retains the stored text operation; Set alone accepts I. Example: members.Note.Like(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Lt ¶
func (c NullableInputText[M, I, V]) Lt(v V) Predicate[M]
Lt retains the stored text operation; Set alone accepts I. Example: members.Note.Lt(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Lte ¶
func (c NullableInputText[M, I, V]) Lte(v V) Predicate[M]
Lte retains the stored text operation; Set alone accepts I. Example: members.Note.Lte(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Ne ¶
func (c NullableInputText[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored text operation; Set alone accepts I. Example: members.Note.Ne(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) NotIn ¶
func (c NullableInputText[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored text operation; Set alone accepts I. Example: members.Note.NotIn(StoredLabel("ada@example.test")).
func (NullableInputText[M, I, V]) Set ¶
func (c NullableInputText[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: members.Note.Set(LabelInput{Text: "ada@example.test"}).
func (NullableInputText[M, I, V]) SetNull ¶
func (c NullableInputText[M, I, V]) SetNull() Assignment[M]
SetNull retains the stored text operation; Set alone accepts I. Example: members.Note.SetNull().
func (NullableInputText[M, I, V]) StartsWith ¶
func (c NullableInputText[M, I, V]) StartsWith(v V) Predicate[M]
StartsWith retains the stored text operation; Set alone accepts I. Example: members.Note.StartsWith(StoredLabel("ada@example.test")).
type NullableInputTime ¶
NullableInputTime accepts I for writes and retains V for stored operations. Example: NullableInputTime[Event, TimestampInput, time.Time].
func NullableInputTimeOf ¶
func NullableInputTimeOf[M, I any, V TimeValue](b Builder[M], ptr *value.Nullable[V], transform func(I) (V, error), opts ...ColumnOption[V]) NullableInputTime[M, I, V]
NullableInputTimeOf binds a distinct input. A nil transform selects the model Mutate method. Example: NullableInputTimeOf[Event, TimestampInput](b, &event.StartsAt, nil).
func (NullableInputTime[M, I, V]) Asc ¶
func (c NullableInputTime[M, I, V]) Asc() Order[M]
Asc retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Asc().
func (NullableInputTime[M, I, V]) Between ¶
func (c NullableInputTime[M, I, V]) Between(a, b V) Predicate[M]
Between retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Between(startsAt, endsAt).
func (NullableInputTime[M, I, V]) Desc ¶
func (c NullableInputTime[M, I, V]) Desc() Order[M]
Desc retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Desc().
func (NullableInputTime[M, I, V]) Eq ¶
func (c NullableInputTime[M, I, V]) Eq(v V) Predicate[M]
Eq retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Eq(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) Gt ¶
func (c NullableInputTime[M, I, V]) Gt(v V) Predicate[M]
Gt retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Gt(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) Gte ¶
func (c NullableInputTime[M, I, V]) Gte(v V) Predicate[M]
Gte retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Gte(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) In ¶
func (c NullableInputTime[M, I, V]) In(v ...V) Predicate[M]
In retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.In(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) IsNotNull ¶
func (c NullableInputTime[M, I, V]) IsNotNull() Predicate[M]
IsNotNull retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.IsNotNull().
func (NullableInputTime[M, I, V]) IsNull ¶
func (c NullableInputTime[M, I, V]) IsNull() Predicate[M]
IsNull retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.IsNull().
func (NullableInputTime[M, I, V]) Lt ¶
func (c NullableInputTime[M, I, V]) Lt(v V) Predicate[M]
Lt retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Lt(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) Lte ¶
func (c NullableInputTime[M, I, V]) Lte(v V) Predicate[M]
Lte retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Lte(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) Ne ¶
func (c NullableInputTime[M, I, V]) Ne(v V) Predicate[M]
Ne retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.Ne(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) NotIn ¶
func (c NullableInputTime[M, I, V]) NotIn(v ...V) Predicate[M]
NotIn retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.NotIn(time.Date(2026, 10, 23, 0, 0, 0, 0, time.UTC)).
func (NullableInputTime[M, I, V]) Set ¶
func (c NullableInputTime[M, I, V]) Set(v I) Assignment[M]
Set captures a typed input without invoking its transform. Example: events.OptionalStartsAt.Set(TimestampInput{Time: startsAt}).
func (NullableInputTime[M, I, V]) SetNull ¶
func (c NullableInputTime[M, I, V]) SetNull() Assignment[M]
SetNull retains the stored time operation; Set alone accepts I. Example: events.OptionalStartsAt.SetNull().
type NullableInterval ¶
type NullableInterval[M any] struct { // contains filtered or unexported fields }
NullableInterval adds SQL NULL to interval predicates and assignments. PostgreSQL compares using 30-day months and 24-hour days: Eq(temporal.Months(1)) also matches 30 days. Hydration preserves distinct calendar and elapsed components. Example: Records.MaybePeriod.IsNull().
func NullableIntervalOf ¶
func NullableIntervalOf[M any](b Builder[M], ptr *value.Nullable[temporal.Interval], opts ...ColumnOption[temporal.Interval]) NullableInterval[M]
NullableIntervalOf binds nullable intervals. Example: NullableIntervalOf(b, &m.MaybePeriod).
func (NullableInterval[M]) Asc ¶
func (c NullableInterval[M]) Asc() Order[M]
Asc sorts ascending. Example: Records.MaybePeriod.Asc().
func (NullableInterval[M]) Between ¶
func (c NullableInterval[M]) Between(a, b temporal.Interval) Predicate[M]
Between includes both endpoints. Example: Records.MaybePeriod.Between(a, b).
func (NullableInterval[M]) Desc ¶
func (c NullableInterval[M]) Desc() Order[M]
Desc sorts descending. Example: Records.MaybePeriod.Desc().
func (NullableInterval[M]) Eq ¶
func (c NullableInterval[M]) Eq(v temporal.Interval) Predicate[M]
Eq compares a concrete value. Example: Records.MaybePeriod.Eq(period).
func (NullableInterval[M]) Gt ¶
func (c NullableInterval[M]) Gt(v temporal.Interval) Predicate[M]
Gt compares ordered values. Example: Records.MaybePeriod.Gt(period).
func (NullableInterval[M]) Gte ¶
func (c NullableInterval[M]) Gte(v temporal.Interval) Predicate[M]
Gte compares ordered values. Example: Records.MaybePeriod.Gte(period).
func (NullableInterval[M]) In ¶
func (c NullableInterval[M]) In(v ...temporal.Interval) Predicate[M]
In tests membership. Example: Records.MaybePeriod.In(a, b).
func (NullableInterval[M]) IsNotNull ¶
func (c NullableInterval[M]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: Records.MaybePeriod.IsNotNull().
func (NullableInterval[M]) IsNull ¶
func (c NullableInterval[M]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: Records.MaybePeriod.IsNull().
func (NullableInterval[M]) Lt ¶
func (c NullableInterval[M]) Lt(v temporal.Interval) Predicate[M]
Lt compares ordered values. Example: Records.MaybePeriod.Lt(period).
func (NullableInterval[M]) Lte ¶
func (c NullableInterval[M]) Lte(v temporal.Interval) Predicate[M]
Lte compares ordered values. Example: Records.MaybePeriod.Lte(period).
func (NullableInterval[M]) Ne ¶
func (c NullableInterval[M]) Ne(v temporal.Interval) Predicate[M]
Ne excludes a concrete value. Example: Records.MaybePeriod.Ne(period).
func (NullableInterval[M]) NotIn ¶
func (c NullableInterval[M]) NotIn(v ...temporal.Interval) Predicate[M]
NotIn excludes membership. Example: Records.MaybePeriod.NotIn(a, b).
func (NullableInterval[M]) Set ¶
func (c NullableInterval[M]) Set(v temporal.Interval) Assignment[M]
Set assigns a value, including zero. Example: Records.MaybePeriod.Set(period).
func (NullableInterval[M]) SetNull ¶
func (c NullableInterval[M]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: Records.MaybePeriod.SetNull().
type NullableJSON ¶
type NullableJSON[M, T any] struct { // contains filtered or unexported fields }
NullableJSON distinguishes SQL NULL from a typed JSON document, including JSON null. Example: Records.MaybeSettings.IsNull().
func NullableJSONOf ¶
func NullableJSONOf[M, T any](b Builder[M], ptr *value.Nullable[value.JSON[T]], opts ...ColumnOption[value.JSON[T]]) NullableJSON[M, T]
NullableJSONOf binds nullable typed JSON. Example: NullableJSONOf(b,&m.MaybeSettings).
func (NullableJSON[M, T]) Asc ¶
func (c NullableJSON[M, T]) Asc() Order[M]
Asc sorts ascending. Example: Records.MaybeSettings.Asc().
func (NullableJSON[M, T]) ContainedBy ¶
func (c NullableJSON[M, T]) ContainedBy(v value.JSON[T]) Predicate[M]
ContainedBy excludes SQL NULL and tests reverse JSONB containment. Example: Records.MaybeSettings.ContainedBy(settings).
func (NullableJSON[M, T]) Contains ¶
func (c NullableJSON[M, T]) Contains(v value.JSON[T]) Predicate[M]
Contains excludes SQL NULL and tests JSONB containment. Example: Records.MaybeSettings.Contains(settings).
func (NullableJSON[M, T]) Desc ¶
func (c NullableJSON[M, T]) Desc() Order[M]
Desc sorts descending. Example: Records.MaybeSettings.Desc().
func (NullableJSON[M, T]) Eq ¶
func (c NullableJSON[M, T]) Eq(v value.JSON[T]) Predicate[M]
Eq compares a concrete value. Example: Records.MaybeSettings.Eq(settings).
func (NullableJSON[M, T]) In ¶
func (c NullableJSON[M, T]) In(v ...value.JSON[T]) Predicate[M]
In tests membership. Example: Records.MaybeSettings.In(a, b).
func (NullableJSON[M, T]) IsJSONNull ¶
func (c NullableJSON[M, T]) IsJSONNull() Predicate[M]
IsJSONNull matches a JSON null document, excluding SQL NULL. Example: Records.MaybeSettings.IsJSONNull().
func (NullableJSON[M, T]) IsNotNull ¶
func (c NullableJSON[M, T]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: Records.MaybeSettings.IsNotNull().
func (NullableJSON[M, T]) IsNull ¶
func (c NullableJSON[M, T]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: Records.MaybeSettings.IsNull().
func (NullableJSON[M, T]) Ne ¶
func (c NullableJSON[M, T]) Ne(v value.JSON[T]) Predicate[M]
Ne excludes a concrete value. Example: Records.MaybeSettings.Ne(settings).
func (NullableJSON[M, T]) NotIn ¶
func (c NullableJSON[M, T]) NotIn(v ...value.JSON[T]) Predicate[M]
NotIn excludes membership. Example: Records.MaybeSettings.NotIn(a, b).
func (NullableJSON[M, T]) Set ¶
func (c NullableJSON[M, T]) Set(v value.JSON[T]) Assignment[M]
Set assigns a valid JSON document; zero value.JSON is rejected without sending SQL. Example: Records.MaybeSettings.Set(settings).
func (NullableJSON[M, T]) SetNull ¶
func (c NullableJSON[M, T]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: Records.MaybeSettings.SetNull().
type NullableNumber ¶
type NullableNumber[M any, V NumberValue] struct { // contains filtered or unexported fields }
NullableNumber exposes nullable numeric values. Example: LedgerEntries.Balance.IsNull().
func NullableNumberOf ¶
func NullableNumberOf[M any, V NumberValue](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableNumber[M, V]
NullableNumberOf binds nullable numeric values. Example: NullableNumberOf(b,&o.Balance).
func (NullableNumber[M, V]) Asc ¶
func (c NullableNumber[M, V]) Asc() Order[M]
Asc sorts ascending. Example: LedgerEntries.Balance.Asc().
func (NullableNumber[M, V]) Between ¶
func (c NullableNumber[M, V]) Between(a, b V) Predicate[M]
Between includes both endpoints. Example: LedgerEntries.Balance.Between(a, b).
func (NullableNumber[M, V]) Decrement ¶
func (c NullableNumber[M, V]) Decrement(amount V, bound ...Bound[V]) Assignment[M]
Decrement subtracts a strictly positive amount; SQL NULL remains NULL. Example: LedgerEntries.Balance.Decrement(amount, orm.AtLeast(floor)).
func (NullableNumber[M, V]) Desc ¶
func (c NullableNumber[M, V]) Desc() Order[M]
Desc sorts descending. Example: LedgerEntries.Balance.Desc().
func (NullableNumber[M, V]) Eq ¶
func (c NullableNumber[M, V]) Eq(v V) Predicate[M]
Eq compares a concrete value. Example: LedgerEntries.Balance.Eq(amount).
func (NullableNumber[M, V]) Gt ¶
func (c NullableNumber[M, V]) Gt(v V) Predicate[M]
Gt compares ordered values. Example: LedgerEntries.Balance.Gt(amount).
func (NullableNumber[M, V]) Gte ¶
func (c NullableNumber[M, V]) Gte(v V) Predicate[M]
Gte compares ordered values. Example: LedgerEntries.Balance.Gte(amount).
func (NullableNumber[M, V]) In ¶
func (c NullableNumber[M, V]) In(v ...V) Predicate[M]
In tests membership. Example: LedgerEntries.Balance.In(a, b).
func (NullableNumber[M, V]) Increment ¶
func (c NullableNumber[M, V]) Increment(amount V, bound ...Bound[V]) Assignment[M]
Increment adds a strictly positive amount; SQL NULL remains NULL. Example: LedgerEntries.Balance.Increment(amount, orm.AtMost(ceiling)).
func (NullableNumber[M, V]) IsNotNull ¶
func (c NullableNumber[M, V]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: LedgerEntries.Balance.IsNotNull().
func (NullableNumber[M, V]) IsNull ¶
func (c NullableNumber[M, V]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: LedgerEntries.Balance.IsNull().
func (NullableNumber[M, V]) Lt ¶
func (c NullableNumber[M, V]) Lt(v V) Predicate[M]
Lt compares ordered values. Example: LedgerEntries.Balance.Lt(amount).
func (NullableNumber[M, V]) Lte ¶
func (c NullableNumber[M, V]) Lte(v V) Predicate[M]
Lte compares ordered values. Example: LedgerEntries.Balance.Lte(amount).
func (NullableNumber[M, V]) Ne ¶
func (c NullableNumber[M, V]) Ne(v V) Predicate[M]
Ne excludes a concrete value. Example: LedgerEntries.Balance.Ne(amount).
func (NullableNumber[M, V]) NotIn ¶
func (c NullableNumber[M, V]) NotIn(v ...V) Predicate[M]
NotIn excludes membership. Example: LedgerEntries.Balance.NotIn(a, b).
func (NullableNumber[M, V]) Set ¶
func (c NullableNumber[M, V]) Set(v V) Assignment[M]
Set assigns a value, including zero. Example: LedgerEntries.Balance.Set(amount).
func (NullableNumber[M, V]) SetNull ¶
func (c NullableNumber[M, V]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: LedgerEntries.Balance.SetNull().
type NullableText ¶
NullableText exposes nullable text. Example: Users.Nickname.SetNull().
func NullableTextOf ¶
func NullableTextOf[M any, V ~string](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableText[M, V]
NullableTextOf binds nullable text. Example: NullableTextOf(b,&o.Nickname).
func (NullableText[M, V]) Asc ¶
func (c NullableText[M, V]) Asc() Order[M]
Asc sorts ascending. Example: Users.Nickname.Asc().
func (NullableText[M, V]) Between ¶
func (c NullableText[M, V]) Between(a, b V) Predicate[M]
Between includes both endpoints. Example: Users.Nickname.Between(a, b).
func (NullableText[M, V]) Contains ¶
func (c NullableText[M, V]) Contains(v V) Predicate[M]
Contains matches a literal substring; wildcards are escaped. Example: Users.Nickname.Contains("da").
func (NullableText[M, V]) Desc ¶
func (c NullableText[M, V]) Desc() Order[M]
Desc sorts descending. Example: Users.Nickname.Desc().
func (NullableText[M, V]) EndsWith ¶
func (c NullableText[M, V]) EndsWith(v V) Predicate[M]
EndsWith matches a literal suffix; wildcards are escaped. Example: Users.Nickname.EndsWith("son").
func (NullableText[M, V]) Eq ¶
func (c NullableText[M, V]) Eq(v V) Predicate[M]
Eq compares a concrete value. Example: Users.Nickname.Eq("Ada").
func (NullableText[M, V]) Gt ¶
func (c NullableText[M, V]) Gt(v V) Predicate[M]
Gt compares ordered values. Example: Users.Nickname.Gt("Ada").
func (NullableText[M, V]) Gte ¶
func (c NullableText[M, V]) Gte(v V) Predicate[M]
Gte compares ordered values. Example: Users.Nickname.Gte("Ada").
func (NullableText[M, V]) IContains ¶
func (c NullableText[M, V]) IContains(v V) Predicate[M]
IContains matches a literal substring case-insensitively; wildcards are escaped. Example: Users.Nickname.IContains("Ada").
func (NullableText[M, V]) IEndsWith ¶
func (c NullableText[M, V]) IEndsWith(v V) Predicate[M]
IEndsWith matches a literal suffix case-insensitively; wildcards are escaped. Example: Users.Nickname.IEndsWith("SON").
func (NullableText[M, V]) ILike ¶
func (c NullableText[M, V]) ILike(v V) Predicate[M]
ILike matches an ILIKE pattern case-insensitively; % and _ are wildcards. Example: Users.Nickname.ILike("a%").
func (NullableText[M, V]) IStartsWith ¶
func (c NullableText[M, V]) IStartsWith(v V) Predicate[M]
IStartsWith matches a literal prefix case-insensitively; wildcards are escaped. Example: Users.Nickname.IStartsWith("ada").
func (NullableText[M, V]) In ¶
func (c NullableText[M, V]) In(v ...V) Predicate[M]
In tests membership. Example: Users.Nickname.In(a, b).
func (NullableText[M, V]) IsNotNull ¶
func (c NullableText[M, V]) IsNotNull() Predicate[M]
IsNotNull excludes SQL NULL. Example: Users.Nickname.IsNotNull().
func (NullableText[M, V]) IsNull ¶
func (c NullableText[M, V]) IsNull() Predicate[M]
IsNull matches SQL NULL. Example: Users.Nickname.IsNull().
func (NullableText[M, V]) Like ¶
func (c NullableText[M, V]) Like(v V) Predicate[M]
Like matches a LIKE pattern; % and _ are wildcards. Example: Users.Nickname.Like("A%").
func (NullableText[M, V]) Lt ¶
func (c NullableText[M, V]) Lt(v V) Predicate[M]
Lt compares ordered values. Example: Users.Nickname.Lt("Ada").
func (NullableText[M, V]) Lte ¶
func (c NullableText[M, V]) Lte(v V) Predicate[M]
Lte compares ordered values. Example: Users.Nickname.Lte("Ada").
func (NullableText[M, V]) Ne ¶
func (c NullableText[M, V]) Ne(v V) Predicate[M]
Ne excludes a concrete value. Example: Users.Nickname.Ne("Ada").
func (NullableText[M, V]) NotIn ¶
func (c NullableText[M, V]) NotIn(v ...V) Predicate[M]
NotIn excludes membership. Example: Users.Nickname.NotIn(a, b).
func (NullableText[M, V]) Set ¶
func (c NullableText[M, V]) Set(v V) Assignment[M]
Set assigns a value, including zero. Example: Users.Nickname.Set("Ada").
func (NullableText[M, V]) SetNull ¶
func (c NullableText[M, V]) SetNull() Assignment[M]
SetNull explicitly clears this field. Example: Users.Nickname.SetNull().
func (NullableText[M, V]) StartsWith ¶
func (c NullableText[M, V]) StartsWith(v V) Predicate[M]
StartsWith matches a literal prefix; wildcards are escaped. Example: Users.Nickname.StartsWith("Ada").
type NullableTime ¶
NullableTime exposes nullable temporal values. Example: Users.Birthday.IsNull().
func NullableTimeOf ¶
func NullableTimeOf[M any, V TimeValue](b Builder[M], ptr *value.Nullable[V], opts ...ColumnOption[V]) NullableTime[M, V]
NullableTimeOf binds nullable temporal values. Example: NullableTimeOf(b,&o.Birthday).
type Number ¶
type Number[M any, V NumberValue] = numberColumn[M, V, ordinaryRole]
Number exposes ordered numeric comparisons. Example: Number[Order,int64].
func NumberOf ¶
func NumberOf[M any, V NumberValue](b Builder[M], ptr *V, opts ...ColumnOption[V]) Number[M, V]
NumberOf selects a numeric codec at startup. Example: NumberOf(b,&o.TotalCents).
type NumberLookupKey ¶
type NumberLookupKey[M any, K interface { NumberValue comparable }] = numberKeyColumn[M, K, lookupKeyRole]
NumberLookupKey retains the primary lookup role. Example: NumberKey(table.Key()).
type NumberPrimary ¶
type NumberPrimary[M any, K interface { NumberValue comparable }] = numberKeyColumn[M, K, primaryRole]
NumberPrimary preserves numeric primary capabilities. Example: NumberKey(PrimaryOf(b, table.Key())).
type NumberValue ¶
type NumberValue interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | decimal.Decimal
}
NumberValue permits exact and approximate numeric fields. Example: Number[Order, int64].
type Observer ¶
type Observer[M any] struct { // contains filtered or unexported fields }
Observer fixes registration to this model's Hooks type. Example: NewObserver[Order]("orders.audit").
func NewDeletionObserver ¶
NewDeletionObserver observes only delete/soft-delete/force-delete writes. Example: NewDeletionObserver[Order]("orders.removal").
func NewObserver ¶
NewObserver declares a write observer without invoking its factory. Example: NewObserver[Order]("orders.audit").
func (Observer[M]) Declare ¶
func (o Observer[M]) Declare(factory func() Hooks[M]) (lifecycle.Declaration, error)
Declare captures a typed per-operation factory. Example: NewObserver[Order]("orders.audit").Declare(orderAuditHooks).
type One ¶
type One[M, N any] struct { // contains filtered or unexported fields }
One identifies a singular model slot. Example: Buyer One[Order,User].
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option configures a declaration. Example: Define("logs", declare, NoTimestamps()).
func NoSoftDeletes ¶
func NoSoftDeletes() Option
NoSoftDeletes disables the DeletedAt convention. Explicit SoftDeleteOf conflicts with this option.
func NoTimestamps ¶
func NoTimestamps() Option
NoTimestamps disables CreatedAt/UpdatedAt conventions. Example: NoTimestamps().
func WithGlobalScopes ¶
func WithGlobalScopes[M any, T CheckedTable](source func(T) []GlobalScope[M]) Option
WithGlobalScopes attaches a lazy immutable source, evaluated once when needed. The source receives an owned copy of the completed declaration, avoiding Go initialization cycles. It may reference relations; it must not execute or compile queries. Example: WithGlobalScopes(func(t OrderTable) []GlobalScope[Order] { return []GlobalScope[Order]{Scope(t.Table, "tenant", tenantPredicate(t))} }).
func WithHooks ¶
WithHooks installs a factory invoked once per normal write, after row locking. Example: Define("orders", declareOrders, WithHooks(func() Hooks[Order] { return Hooks[Order]{} })).
func WithRetrievalHooks ¶
func WithRetrievalHooks[M any](factory func() RetrievalHooks[M]) Option
WithRetrievalHooks installs a factory run once per nonempty complete batch. Example: WithRetrievalHooks(func() RetrievalHooks[Order] { return orderReadHooks() }).
type Order ¶
type Order[M any] struct { // contains filtered or unexported fields }
Order is a model-owned sort direction. Example: Orders.ID.Asc().
func FoundryRelationOrder ¶
func FoundryRelationOrder[M, N any](r ExistenceRelation[M, N], o ormcore.Order, seal sqlowner.MetadataSeal) Order[N]
FoundryRelationOrder validates a computed order against the actual relation target. Example: FoundryRelationOrder(r,o,sqlowner.Metadata()).
func FoundryRelationPivotOrder ¶
func FoundryRelationPivotOrder[M, N, P any](r ThroughRelation[M, N, P], o ormcore.Order, seal sqlowner.MetadataSeal) Order[P]
FoundryRelationPivotOrder validates both relation owners and the concrete pivot. Example: FoundryRelationPivotOrder(r,o,sqlowner.Metadata()).
func (Order[M]) NullsFirst ¶
NullsFirst places NULL before concrete values.
type OrderedExpressionColumn ¶
type OrderedExpressionColumn[M, V, P any] interface { ExpressionColumn[M, V, P] // contains filtered or unexported methods }
OrderedExpressionColumn is the sealed capability for ordered stored fields. The private marker also covers input handles: aggregates read their stored value. Example: func minimum[M,V,P any,C orm.OrderedExpressionColumn[M,V,P]](c C).
type PageRequest ¶
type PageRequest = querycore.PageRequest
PageRequest retains the existing pagination validation contract. Example: Page(2,20).
func Page ¶
func Page(number, size int) PageRequest
Page selects a one-based page. Example: Orders.Query().Paginate(ctx,db,Page(2,20)).
type PageResult ¶
PageResult retains the existing pagination response contract. Example: page.Items.
type PivotChanges ¶
type PivotChanges[P any] struct { // Attached contains newly inserted pivots. Example: changes.Attached[0].ID // identifies the membership created by Sync or Toggle. Attached []P // Detached contains pivots removed by Sync or Toggle. Soft-delete models // remain stored with DeletedAt set; ordinary models are physically deleted. // Example: changes.Detached[0].ID identifies the removed membership in either case. Detached []P // Updated contains retained pivots patched by Sync or SyncWithoutDetaching. // Example: changes.Updated[0].Role is the membership role after its update. Updated []P }
PivotChanges contains reconciliation-ready concrete pivot models. Example: changes.Attached[0].ID.
func Sync ¶
func Sync[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, targets []N, create, update []Assignment[P]) (PivotChanges[P], error)
Sync creates missing links, removes others and optionally updates retained links. A nil update leaves retained links unchanged. Example: orm.Sync(ctx,db,links,user,groups,create,nil).
func SyncWithoutDetaching ¶
func SyncWithoutDetaching[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, targets []N, create, update []Assignment[P]) (PivotChanges[P], error)
SyncWithoutDetaching creates missing links and optionally updates retained links. Example: orm.SyncWithoutDetaching(ctx,db,links,user,groups,create,nil).
func Toggle ¶
func Toggle[M, N, P any](ctx context.Context, writer database.Transactor, r ThroughRelation[M, N, P], source M, targets []N, create ...Assignment[P]) (PivotChanges[P], error)
Toggle removes linked targets and attaches unlinked targets atomically. Example: orm.Toggle(ctx,db,links,user,groups,Memberships.Role.Set("member")).
type Plan ¶
Plan owns bounded PostgreSQL plan data; formatting omits predicates and values. Example: plan.Root().TotalCost.
func Explain ¶
Explain plans a SELECT without hydration, retrieval callbacks or eager loads. Example: orm.Explain(ctx, db, Users.Query()).
func ExplainAnalyze ¶
ExplainAnalyze executes the SELECT and includes actual measurements. Example: orm.ExplainAnalyze(ctx, db, Users.Query().Limit(10)).
func ExplainAnalyzeLocked ¶
func ExplainAnalyzeLocked[M any](ctx context.Context, tx *database.Tx, q LockedQuery[M]) (Plan, error)
ExplainAnalyzeLocked takes the SELECT locks in the caller's transaction. Example: orm.ExplainAnalyzeLocked(ctx, tx, Users.Query().ForUpdate()).
func ExplainLocked ¶
ExplainLocked plans a locked SELECT using its required transaction. Example: orm.ExplainLocked(ctx, tx, Users.Query().ForUpdate()).
type Predicate ¶
type Predicate[M any] struct { // contains filtered or unexported fields }
Predicate is a model-owned SQL condition. Example: Orders.ID.Eq(id).
func And ¶
And combines model-owned conditions. Example: And(Orders.ID.Eq(id),Orders.TotalCents.Gt(0)).
func FoundryRelationFilter ¶
func FoundryRelationFilter[M, N any](r ExistenceRelation[M, N], p ormcore.Predicate, seal sqlowner.MetadataSeal) Predicate[N]
FoundryRelationFilter validates expression conditions for a relation target. Example: FoundryRelationFilter(r,p,sqlowner.Metadata()).
func FoundryRelationPredicate ¶
func FoundryRelationPredicate[M, N any](r ExistenceRelation[M, N], ps []ormcore.Predicate, seal sqlowner.MetadataSeal) Predicate[M]
FoundryRelationPredicate validates projected child conditions at the relation owner. Example: FoundryRelationPredicate(r,ps,sqlowner.Metadata()).
func Has ¶
func Has[M, N any](r ExistenceRelation[M, N], ps ...Predicate[N]) Predicate[M]
Has matches parents with related rows satisfying the target predicates and related scopes, without eager loading. Example: Users.Query().Where(orm.Has(UserRelations.Orders)).
func UUIDGreater ¶
UUIDGreater compares model-owned UUIDs bytewise. Example: orm.UUIDGreater(Files.Key(),after).
func UUIDGreaterOrEqual ¶
UUIDGreaterOrEqual compares model-owned UUIDs bytewise. Example: orm.UUIDGreaterOrEqual(Files.Key(),after).
func UUIDLess ¶
UUIDLess compares model-owned UUIDs bytewise. Example: orm.UUIDLess(Files.Key(),after).
func UUIDLessOrEqual ¶
UUIDLessOrEqual compares model-owned UUIDs bytewise. Example: orm.UUIDLessOrEqual(Files.Key(),after).
type Primary ¶
type Primary[M any, K comparable] = keyColumn[M, K, primaryRole]
Primary is an unmutated primary column eligible for insert-select mapping. Example: ID Primary[User, model.ID[User]]. Ordinary lookups only need Table.Key.
type Query ¶
type Query[M any] struct { // contains filtered or unexported fields }
Query stores only a model-independent AST and table binding. Example: Orders.Query().Where(Orders.ID.Eq(id)).
func FoundryOrderBy ¶
FoundryOrderBy appends sealed computed row ordering in a model's original scope. Example: FoundryOrderBy(q,o,sqlowner.Queries()).
func FoundryWhere ¶
FoundryWhere appends a sealed computed predicate in a model's original scope. Example: FoundryWhere(q,p,sqlowner.Queries()).
func WithRelationLimits ¶
func WithRelationLimits[M any](q Query[M], limits RelationLimits) Query[M]
WithRelationLimits returns a query with immutable tree-wide limits. Example: q = orm.WithRelationLimits(q, orm.RelationLimits{BatchSize:100,MaxRows:5000,MaxDepth:4}).
func WithScopeContext ¶
WithScopeContext supplies context for Compile; execution always uses its own context. Example: Compile(WithScopeContext(Orders.Query(), ctx)).
func WithoutGlobalScope ¶
func WithoutGlobalScope[M any](q Query[M], scopes ...GlobalScope[M]) Query[M]
WithoutGlobalScope removes named defaults from this query only, preserving explicit predicates and soft-delete visibility. Example: WithoutGlobalScope(Orders.Query(), orderTenantScope).
func WithoutGlobalScopes ¶
WithoutGlobalScopes removes all model defaults from this query only. Example: WithoutGlobalScopes(Orders.Query()).Where(Orders.ID.Eq(id)).
func WithoutModelHooks ¶
WithoutModelHooks acknowledges set writes skip per-model hooks, observers and changes. Per-model writes reject this flag. Example: WithoutModelHooks(Orders.Query()).UpdateAll(ctx,db,Orders.TotalCents.Set(0)).
func (Query[M]) All ¶
All hydrates complete models, discarding partial results on failure. Example: Orders.Query().All(ctx,db).
func (Query[M]) Chunk ¶
func (q Query[M]) Chunk(ctx context.Context, ex database.Executor, size int, yield func([]M) error) error
Chunk reads stable, bounded batches, closing rows before each callback. It preserves the query window and advances by keyset when ordering permits; explicit NULL placement falls back to offsets. It does not create a snapshot.
func (Query[M]) DeleteAll ¶
DeleteAll removes matching rows, respecting soft deletion. Example: Orders.Query().Where(Orders.ID.Eq(id)).DeleteAll(ctx,tx).
func (Query[M]) Each ¶
Each streams models while rows remain open when retrieval cannot run. Otherwise it uses closed complete batches, dispatching Retrieved before yielding models. Rows yielded before a later failed batch remain yielded.
func (Query[M]) EachChunked ¶
func (q Query[M]) EachChunked(ctx context.Context, ex database.Executor, size int, yield func(M) error) error
EachChunked yields individual models from fully read and closed batches.
func (Query[M]) First ¶
First returns an omitted Optional on no match. Example: Orders.Query().First(ctx,db).
func (Query[M]) ForKeyShare ¶
func (q Query[M]) ForKeyShare() LockedQuery[M]
ForKeyShare protects selected keys against deletion and key changes.
func (Query[M]) ForNoKeyUpdate ¶
func (q Query[M]) ForNoKeyUpdate() LockedQuery[M]
ForNoKeyUpdate requests a lock compatible with key-share locks.
func (Query[M]) ForShare ¶
func (q Query[M]) ForShare() LockedQuery[M]
ForShare requests share locks. Example: Orders.Query().ForShare().All(ctx,tx).
func (Query[M]) ForUpdate ¶
func (q Query[M]) ForUpdate() LockedQuery[M]
ForUpdate requests update locks. Example: Orders.Query().ForUpdate().All(ctx,tx).
func (Query[M]) ForceDeleteAll ¶
func (q Query[M]) ForceDeleteAll(ctx context.Context, tx database.Transactor, soft SoftDeletable[M]) (int64, error)
ForceDeleteAll physically deletes matching rows within the selected scope.
func (Query[M]) OnlyTrashed ¶
OnlyTrashed selects deleted records. Example: records.Query().OnlyTrashed().All(ctx,db).
func (Query[M]) OrderBy ¶
OrderBy appends sort directions. Example: Orders.Query().OrderBy(Orders.ID.Asc()).
func (Query[M]) Paginate ¶
func (q Query[M]) Paginate(ctx context.Context, ex database.Executor, request PageRequest) (PageResult[M], error)
Paginate reads a matching total and a stable page. Example: Orders.Query().Paginate(ctx,db,Page(1,20)).
func (Query[M]) Require ¶
Require returns database.NotFound on no match. Example: Orders.Query().Require(ctx,db).
func (Query[M]) SimplePaginate ¶
func (q Query[M]) SimplePaginate(ctx context.Context, ex database.Executor, request PageRequest) (SimplePage[M], error)
SimplePaginate fetches one extra row to determine whether another page exists.
func (Query[M]) UpdateAll ¶
func (q Query[M]) UpdateAll(ctx context.Context, tx database.Transactor, as ...Assignment[M]) (int64, error)
UpdateAll patches every matching row. Example: Orders.Query().Where(Orders.TotalCents.Eq(0)).UpdateAll(ctx,tx,Orders.TotalCents.Set(1)).
func (Query[M]) Where ¶
Where appends AND predicates. Example: Orders.Query().Where(Orders.TotalCents.Gt(0)).
func (Query[M]) With ¶
With adds batched eager loading. Example: Orders.Query().With(OrderRelations.Buyer).
func (Query[M]) WithTrashed ¶
WithTrashed includes deleted records. Example: records.Query().WithTrashed().All(ctx,db).
func (Query[M]) WithoutTrashed ¶
WithoutTrashed restores the default active-record scope.
type RelatedLookup ¶
type RelatedLookup[P, M any, K comparable] struct { // contains filtered or unexported fields }
RelatedLookup retains the parent, target and alternate-key types. Example: orm.RelatedUnique(TeamRelations.Projects,Projects.Slug).
func RelatedUnique ¶
func RelatedUnique[P, M any, K comparable, R DirectRelation[P, M]](relation R, field KeyColumn[M, K]) RelatedLookup[P, M, K]
RelatedUnique scopes a unique lookup through a loaded parent without a fallback query. Example: orm.RelatedUnique(TeamRelations.Projects,Projects.Slug).Find(ctx,db,team,slug).
func (RelatedLookup[P, M, K]) Find ¶
func (l RelatedLookup[P, M, K]) Find(ctx context.Context, ex database.Executor, parent P, key K) (value.Optional[M], error)
Find retains the relationship predicate, target filters and ordinary hydration. Example: lookup.Find(ctx,db,team,slug).
func (RelatedLookup[P, M, K]) Format ¶
func (RelatedLookup[P, M, K]) Format(s fmt.State, _ rune)
Format redacts parent and target scopes. Example: fmt.Sprintf("%+v", related).
func (RelatedLookup[P, M, K]) GoString ¶
func (RelatedLookup[P, M, K]) GoString() string
GoString redacts Go-syntax diagnostics. Example: fmt.Sprintf("%#v", related).
func (RelatedLookup[P, M, K]) String ¶
func (RelatedLookup[P, M, K]) String() string
String redacts parent and target scopes. Example: fmt.Sprint(related).
func (RelatedLookup[P, M, K]) Validate ¶
func (l RelatedLookup[P, M, K]) Validate() error
Validate rejects non-direct plans and windowed target scopes. Example: lookup.Validate().
type Relation ¶
type Relation[M any] interface { // contains filtered or unexported methods }
Relation is a model-owned, immutable eager-loading descriptor. Example: q.With(OrderRelations.Buyer).
type RelationLimits ¶
type RelationLimits = querycore.RelationLimits
RelationLimits is the existing shared public limits type. MaxRows separately bounds fetched rows and attached values across the whole tree. Example: limits := orm.DefaultRelationLimits().
func DefaultRelationLimits ¶
func DefaultRelationLimits() RelationLimits
DefaultRelationLimits uses the shared defaults: batches 500, rows 10000, depth 8. Example: limits := orm.DefaultRelationLimits().
type RetrievalHooks ¶
type RetrievalHooks[M any] struct { // Retrieved receives the caller's executor; reads create no implicit write transaction. // Example: Retrieved: func(ctx context.Context, ex database.Executor, order Order) error { return nil }. Retrieved func(context.Context, database.Executor, M) error }
RetrievalHooks observes complete stored models after hydration and row closure. Example: RetrievalHooks[Order]{Retrieved: inspectOrder}.
type RetrievalObserver ¶
type RetrievalObserver[M any] struct { // contains filtered or unexported fields }
RetrievalObserver retains a retrieval-only model factory at registration. Example: NewRetrievalObserver[Order]("orders.read").
func NewRetrievalObserver ¶
func NewRetrievalObserver[M any](name string) RetrievalObserver[M]
NewRetrievalObserver declares an instance-owned complete-read observer. Example: NewRetrievalObserver[Order]("orders.read").
func (RetrievalObserver[M]) Declare ¶
func (o RetrievalObserver[M]) Declare(factory func() RetrievalHooks[M]) (lifecycle.Declaration, error)
Declare captures the per-batch factory without running it. Example: observer.Declare(orderReadHooks).
func (RetrievalObserver[M]) Name ¶
func (o RetrievalObserver[M]) Name() string
Name returns the registration identifier. Example: observer.Name().
func (RetrievalObserver[M]) Validate ¶
func (o RetrievalObserver[M]) Validate() error
Validate checks the identifier without constructing hooks. Example: observer.Validate().
type SimplePage ¶
type SimplePage[M any] = querycore.SimplePage[M]
SimplePage retains the existing page-without-total response contract.
type Slot ¶
type Slot[M, S any] struct { // contains filtered or unexported fields }
Slot binds an extension value without persisting a model column. Example: Title orm.Slot[Article,translations.Text].
type SoftDeletable ¶
type SoftDeletable[M any] struct { // contains filtered or unexported fields }
SoftDeletable authorizes restoring or physically deleting soft-delete models. Example: Soft SoftDeletable[User]. Its zero value is invalid.
func SoftDeletes ¶
func SoftDeletes[M any, V InstantValue](field SoftDelete[M, V]) SoftDeletable[M]
SoftDeletes captures the explicitly declared deletion column. Example: Soft: SoftDeletes(deletedAt).
type SoftDelete ¶
type SoftDelete[M any, V InstantValue] = nullableTimeColumn[M, V, deletedRole]
SoftDelete is a nullable deletion instant. Example: SoftDeleteOf(b,&o.DeletedAt).
func SoftDeleteOf ¶
func SoftDeleteOf[M any, V InstantValue](b Builder[M], ptr *value.Nullable[V]) SoftDelete[M, V]
SoftDeleteOf explicitly marks a deletion timestamp. Example: SoftDeleteOf(b,&o.DeletedAt).
type SourceKey ¶
type SourceKey[S, M any] struct { // contains filtered or unexported fields }
SourceKey matches a stored primary value without assigning it. Example: rows.MatchSource(Users.ID,expr.Value(Archives.UserID)).
func FoundrySourceKey ¶
func FoundrySourceKey[S, M any](m ormcore.ModelMapping, seal sqlowner.ExpressionSeal) SourceKey[S, M]
FoundrySourceKey binds a framework expression to a stored primary key. Example: FoundrySourceKey[Archive,User](mapping,sqlowner.Expressions()).
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
Statement is an immutable compiled statement. Example: s,err := Compile(Orders.Query()).
func CompileLocked ¶
func CompileLocked[M any](q LockedQuery[M]) (Statement, error)
CompileLocked inspects a locked read without I/O. Example: CompileLocked(Orders.Query().ForUpdate()).
func FoundryStatement ¶
FoundryStatement retains the shared immutable inspection boundary. Example: FoundryStatement(s,sqlowner.Metadata()).
func (Statement) Arguments ¶
Arguments returns an owned binding snapshot. Example: statement.Arguments().
func (Statement) GoString ¶
GoString omits SQL and bindings from diagnostics. Example: fmt.Sprintf("%#v",statement).
type Table ¶
type Table[M any, K comparable] struct { // contains filtered or unexported fields }
Table retains the model and primary-key types. Example: Table[Order,model.ID[Order]].
func TableOf ¶
func TableOf[M any, K comparable](b Builder[M], ptr *K, opts ...ColumnOption[K]) Table[M, K]
TableOf declares the primary key once. Example: tbl := TableOf(b,&o.ID).
func (Table[M, K]) Delete ¶
Delete removes one key, using soft deletion when declared. Example: Orders.Delete(ctx,tx,id).
func (Table[M, K]) Find ¶
func (t Table[M, K]) Find(ctx context.Context, ex database.Executor, key K) (value.Optional[M], error)
Find selects by a typed primary key. Example: Orders.Find(ctx,db,id).
func (Table[M, K]) ForceDelete ¶
func (t Table[M, K]) ForceDelete(ctx context.Context, tx database.Transactor, soft SoftDeletable[M], key K) (M, error)
ForceDelete physically deletes one active key. Use the package ForceDelete function for other visibility.
func (Table[M, K]) Insert ¶
func (t Table[M, K]) Insert(ctx context.Context, tx database.Transactor, as ...Assignment[M]) (M, error)
Insert creates and hydrates one model. Example: Orders.Insert(ctx,tx,Orders.TotalCents.Set(10),Orders.BuyerID.Set(buyer)).
func (Table[M, K]) InsertMany ¶
func (t Table[M, K]) InsertMany(ctx context.Context, tx database.Transactor, rows [][]Assignment[M]) ([]M, error)
InsertMany inserts one bounded atomic batch and hydrates RETURNING rows.
func (Table[M, K]) Query ¶
Query starts an immutable model query. Example: Orders.Query().Limit(20).
func (Table[M, K]) Raw ¶
func (t Table[M, K]) Raw(ctx context.Context, ex database.Executor, sql string, args ...any) ([]M, error)
Raw hydrates the exact declared column set, matched by name in any order. It applies NO scopes, including soft-delete and tenant/global scopes, and uses ex directly without read routing: raw SQL may write. Supply bound arguments. Example: Orders.Raw(ctx, tx, "UPDATE orders SET total_cents=$1 RETURNING *", cents). Retrieved hooks and observers run after complete hydration and row closure. Decode/open/hook failure discards results; this does not imply a raw write rolled back.
func (Table[M, K]) Require ¶
Require selects a key or returns database.NotFound. Example: Orders.Require(ctx,db,id).
func (Table[M, K]) Update ¶
func (t Table[M, K]) Update(ctx context.Context, tx database.Transactor, key K, as ...Assignment[M]) (M, error)
Update patches one typed key and hydrates it. Example: Orders.Update(ctx,tx,id,Orders.TotalCents.Set(20)).
type TextExpressionColumn ¶
type TextExpressionColumn[M, V, P any] interface { OrderedExpressionColumn[M, V, P] Contains(V) Predicate[M] }
TextExpressionColumn preserves text operations at the expression boundary. The interface excludes direct non-text inputs. Adapters also validate the retrieved column metadata: embedding can promote markers from another handle. Example: expr.TextRow(Users.Name).Contains("Ada").
type TextLookupKey ¶
TextLookupKey retains the primary lookup role. Example: TextKey(table.Key()).
type TextPrimary ¶
TextPrimary preserves text primary capabilities. Example: TextKey(PrimaryOf(b, table.Key())).
type Through ¶
type Through[M, N, P any] struct { // contains filtered or unexported fields }
Through identifies a typed pivot slot. Example: Groups orm.Through[User,Group,Membership].
type ThroughRelation ¶
type ThroughRelation[M, N, P any] struct { // contains filtered or unexported fields }
ThroughRelation retains source, target and pivot owners in a thin immutable plan. Example: UserRelations.Groups.WherePivot(Memberships.Role.Eq("admin")).
func ManyToManyOf ¶
func ManyToManyOf[M, N, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], pivotForeign KeyColumn[P, B], foreign KeyColumn[N, B]) ThroughRelation[M, N, P]
ManyToManyOf unifies both key pairs and binds a concrete pivot slot. Example: orm.ManyToManyOf(Users.Groups,Users.ID,Memberships.UserID,Memberships.GroupID,Groups.ID).
func MorphToManyOf ¶
func MorphToManyOf[M model.Morphable, N, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], kind KeyColumn[P, model.MorphName], pivotForeign KeyColumn[P, B], foreign KeyColumn[N, B]) ThroughRelation[M, N, P]
MorphToManyOf filters the shared pivot by the source discriminator. Example: orm.MorphToManyOf(Posts.Tags,Posts.ID,Taggables.OwnerID,Taggables.OwnerType,Taggables.TagID,Tags.ID).
func MorphedByManyOf ¶
func MorphedByManyOf[M any, N model.Morphable, P any, A, B comparable](slot Through[M, N, P], local KeyColumn[M, A], pivotLocal KeyColumn[P, A], kind KeyColumn[P, model.MorphName], pivotForeign KeyColumn[P, B], foreign KeyColumn[N, B]) ThroughRelation[M, N, P]
MorphedByManyOf filters the shared pivot by one concrete target discriminator. Example: orm.MorphedByManyOf(Tags.Posts,Tags.ID,Taggables.TagID,Taggables.OwnerType,Taggables.OwnerID,Posts.ID).
func WithRelationWriteLimit ¶
func WithRelationWriteLimit[M, N, P any](r ThroughRelation[M, N, P], limit int) ThroughRelation[M, N, P]
WithRelationWriteLimit lowers the atomic row bound without changing read limits. Example: links := orm.WithRelationWriteLimit(UserRelations.Groups,100).
func WithoutPivotGlobalScope ¶
func WithoutPivotGlobalScope[M, N, P any](r ThroughRelation[M, N, P], scopes ...GlobalScope[P]) ThroughRelation[M, N, P]
WithoutPivotGlobalScope removes named pivot defaults only. Example: WithoutPivotGlobalScope(UserRelations.Groups, membershipTenantScope).
func WithoutPivotGlobalScopes ¶
func WithoutPivotGlobalScopes[M, N, P any](r ThroughRelation[M, N, P]) ThroughRelation[M, N, P]
WithoutPivotGlobalScopes removes every pivot default only. Example: WithoutPivotGlobalScopes(UserRelations.Groups).
func (ThroughRelation[M, N, P]) OnlyTrashed ¶
func (r ThroughRelation[M, N, P]) OnlyTrashed() ThroughRelation[M, N, P]
OnlyTrashed sets visibility for this side only. Example: links.OnlyTrashed().
func (ThroughRelation[M, N, P]) OnlyTrashedPivot ¶
func (r ThroughRelation[M, N, P]) OnlyTrashedPivot() ThroughRelation[M, N, P]
OnlyTrashedPivot sets visibility for this side only. Example: links.OnlyTrashedPivot().
func (ThroughRelation[M, N, P]) OrderBy ¶
func (r ThroughRelation[M, N, P]) OrderBy(orders ...Order[N]) ThroughRelation[M, N, P]
OrderBy derives an immutable joined descriptor for its typed side. Example: links.OrderBy(Groups.Name.Asc()).
func (ThroughRelation[M, N, P]) OrderByPivot ¶
func (r ThroughRelation[M, N, P]) OrderByPivot(orders ...Order[P]) ThroughRelation[M, N, P]
OrderByPivot derives an immutable joined descriptor for its typed side. Example: links.OrderByPivot(Memberships.ID.Asc()).
func (ThroughRelation[M, N, P]) Where ¶
func (r ThroughRelation[M, N, P]) Where(ps ...Predicate[N]) ThroughRelation[M, N, P]
Where derives an immutable joined descriptor for its typed side. Example: links.Where(Groups.Name.Eq("maintainers")).
func (ThroughRelation[M, N, P]) WherePivot ¶
func (r ThroughRelation[M, N, P]) WherePivot(ps ...Predicate[P]) ThroughRelation[M, N, P]
WherePivot derives an immutable joined descriptor for its typed side. Example: links.WherePivot(Memberships.Role.Eq("admin")).
func (ThroughRelation[M, N, P]) With ¶
func (r ThroughRelation[M, N, P]) With(children ...Relation[N]) ThroughRelation[M, N, P]
With derives an immutable joined descriptor for its typed side. Example: links.With(GroupRelations.Owner).
func (ThroughRelation[M, N, P]) WithPivot ¶
func (r ThroughRelation[M, N, P]) WithPivot(children ...Relation[P]) ThroughRelation[M, N, P]
WithPivot derives an immutable joined descriptor for its typed side. Example: links.WithPivot(MembershipRelations.Inviter).
func (ThroughRelation[M, N, P]) WithTrashed ¶
func (r ThroughRelation[M, N, P]) WithTrashed() ThroughRelation[M, N, P]
WithTrashed sets visibility for this side only. Example: links.WithTrashed().
func (ThroughRelation[M, N, P]) WithTrashedPivot ¶
func (r ThroughRelation[M, N, P]) WithTrashedPivot() ThroughRelation[M, N, P]
WithTrashedPivot sets visibility for this side only. Example: links.WithTrashedPivot().
func (ThroughRelation[M, N, P]) WithoutTrashed ¶
func (r ThroughRelation[M, N, P]) WithoutTrashed() ThroughRelation[M, N, P]
WithoutTrashed sets visibility for this side only. Example: links.WithoutTrashed().
func (ThroughRelation[M, N, P]) WithoutTrashedPivot ¶
func (r ThroughRelation[M, N, P]) WithoutTrashedPivot() ThroughRelation[M, N, P]
WithoutTrashedPivot sets visibility for this side only. Example: links.WithoutTrashedPivot().
type TimeValue ¶
type TimeValue interface {
time.Time | temporal.DateTime | temporal.Date | temporal.Time | temporal.LocalDateTime
}
TimeValue permits supported temporal fields. Example: Time[Order, temporal.DateTime].
type UpdateMapping ¶
type UpdateMapping[S, M any] struct { // contains filtered or unexported fields }
UpdateMapping maps a non-primary stored value. Example: rows.MapUpdate(Users.Name,expr.Value(Archives.Name)).
func FoundryUpdateMapping ¶
func FoundryUpdateMapping[S, M any](m ormcore.ModelMapping, seal sqlowner.ExpressionSeal) UpdateMapping[S, M]
FoundryUpdateMapping binds a framework expression to its destination. Example: FoundryUpdateMapping[Archive,User](mapping,sqlowner.Expressions()).
type UpdateSource ¶
type UpdateSource[S, M any] struct { // contains filtered or unexported fields }
UpdateSource updates matching models; ambiguous mapped values roll back. Example: rows.UpdateFrom(Users.Query(),rows.From(Archives.Query())).
func FoundryUpdateFrom ¶
func FoundryUpdateFrom[S, M any](q Query[M], source ormcore.Source, seal sqlowner.QuerySeal) UpdateSource[S, M]
FoundryUpdateFrom creates a source update plan. Example: FoundryUpdateFrom[Archive](Users.Query(),source,sqlowner.Queries()).
func (UpdateSource[S, M]) Exec ¶
func (p UpdateSource[S, M]) Exec(ctx context.Context, writer database.Transactor) (int64, error)
Exec rolls back ambiguous SQL-mapped updates. Example: plan.Exec(ctx,db).
func (UpdateSource[S, M]) Format ¶
func (UpdateSource[S, M]) Format(s fmt.State, _ rune)
Format hides captured source values. Example: fmt.Sprintf("%#v",plan).
func (UpdateSource[S, M]) Match ¶
func (p UpdateSource[S, M]) Match(key SourceKey[S, M]) UpdateSource[S, M]
Match replaces the source-to-primary match. Example: plan.Match(rows.MatchSource(Users.ID,expr.Value(Archives.UserID))).
func (UpdateSource[S, M]) Returning ¶
func (p UpdateSource[S, M]) Returning(ctx context.Context, writer database.Transactor, limit int) ([]M, error)
Returning preserves complete hydration and rejects ambiguous matches. Example: plan.Returning(ctx,db,100).
func (UpdateSource[S, M]) Select ¶
func (p UpdateSource[S, M]) Select(mappings ...UpdateMapping[S, M]) UpdateSource[S, M]
Select appends stored-value mappings without bypassing mutators. Example: plan.Select(rows.MapUpdate(Users.Name,expr.Value(Archives.Name))).
func (UpdateSource[S, M]) Values ¶
func (p UpdateSource[S, M]) Values(values ...Assignment[M]) UpdateSource[S, M]
Values replaces literal inputs; repeated source keys are allowed without mappings. Example: plan.Values(Users.Name.Set("archived")).
type UpdateTarget ¶
type UpdateTarget[M, V, P any] interface { ExpressionColumn[M, V, P] ordinaryLayouts[M, V] | createdLayouts[M, V] }
UpdateTarget excludes all primary keys, mutators and managed update timestamps. Example: rows.MapUpdate(Users.Name, expr.Value(Archives.Name)).
type UpdatedAt ¶
type UpdatedAt[M any, V InstantValue] = timeColumn[M, V, updatedRole]
UpdatedAt is an explicitly managed update instant. Example: UpdatedAtOf(b,&o.UpdatedAt).
func UpdatedAtOf ¶
func UpdatedAtOf[M any, V InstantValue](b Builder[M], ptr *V) UpdatedAt[M, V]
UpdatedAtOf explicitly marks an update timestamp. Example: UpdatedAtOf(b,&o.UpdatedAt).
type Value ¶
type Value[M, V any] struct { // contains filtered or unexported fields }
Value identifies a typed computed slot. Example: OrdersCount orm.Value[User,int64].
func ValueOf ¶
ValueOf binds an aggregate slot during Define. Example: orm.ValueOf(b,&u.OrdersCount).
func (Value[M, V]) Using ¶
func (v Value[M, V]) Using(computation AggregateRelation[M, V]) AggregateRelation[M, V]
Using binds a computation with the slot's exact owner and result type. Example: Users.OrdersCount.Using(expr.Related(UserRelations.Orders,expr.Count[Order]())).
type ValueLookup ¶
type ValueLookup[M any, V comparable] struct { // contains filtered or unexported fields }
ValueLookup observes a stored field without hydrating models or running retrieval hooks. It is advisory, not a reservation. Example: orm.Lookup(Users.Query(), Users.Email).
func Lookup ¶
func Lookup[M any, V comparable](source Query[M], field KeyColumn[M, V]) ValueLookup[M, V]
Lookup binds a stored column's non-null value type to its complete model scope. Ordering, pagination and eager loading are rejected. Example: orm.Lookup(Users.Query(), Users.Nickname).
func (ValueLookup[M, V]) AllExist ¶
func (l ValueLookup[M, V]) AllExist(ctx context.Context, ex database.Executor, input []V) (bool, error)
AllExist checks SQL equality in batches of 64, including duplicate representations. Empty input performs no I/O. Example: lookup.AllExist(ctx, db, emails).
func (ValueLookup[M, V]) AnyExist ¶
func (l ValueLookup[M, V]) AnyExist(ctx context.Context, ex database.Executor, input []V) (bool, error)
AnyExist checks IN predicates in batches of 64 and stops on the first match. Empty input performs no I/O. Example: lookup.AnyExist(ctx, db, emails).
func (ValueLookup[M, V]) Exists ¶
Exists performs one equality observation without a transaction. Example: lookup.Exists(ctx, db, email).
func (ValueLookup[M, V]) Format ¶
func (l ValueLookup[M, V]) Format(s fmt.State, _ rune)
Format redacts every formatting verb. Example: fmt.Sprintf("%+v", lookup).
func (ValueLookup[M, V]) GoString ¶
func (l ValueLookup[M, V]) GoString() string
GoString redacts Go-syntax diagnostics. Example: fmt.Sprintf("%#v", lookup).
func (ValueLookup[M, V]) String ¶
func (ValueLookup[M, V]) String() string
String redacts retained predicates. Example: fmt.Sprint(lookup).
func (ValueLookup[M, V]) Validate ¶
func (l ValueLookup[M, V]) Validate() error
Validate checks declarations without encoding values or performing I/O. Example: lookup.Validate().
type Write ¶
type Write[M any] struct { // contains filtered or unexported fields }
Write is an operation-local draft. Use it only during Saving/Creating/Updating. Example: WriteSet(write, Orders.TotalCents.Set(0)).
type WriteError ¶
type WriteError[R any] struct { // contains filtered or unexported fields }
WriteError preserves a candidate when persistence needs reconciliation. Example: errors.As(err,&writeError).
func (*WriteError[R]) Candidate ¶
func (e *WriteError[R]) Candidate() R
Candidate is reconciliation data, not proof of persistence. Example: writeError.Candidate().
func (*WriteError[R]) Error ¶
func (e *WriteError[R]) Error() string
Error omits model values. Example: writeError.Error().
func (*WriteError[R]) GoString ¶
func (e *WriteError[R]) GoString() string
GoString omits model values. Example: fmt.Sprintf("%#v",writeError).
func (*WriteError[R]) Unwrap ¶
func (e *WriteError[R]) Unwrap() error
Unwrap retains the original transaction outcome. Example: errors.As(writeError, &databaseError).
Source Files
¶
- adjustment.go
- adjustment_write.go
- audit.go
- audit_read.go
- changes.go
- chunk.go
- codecs.go
- column.go
- column_conflict.go
- column_input.go
- column_interval.go
- column_json.go
- column_methods.go
- column_role.go
- column_sensitive.go
- conflict.go
- conflict_bridge.go
- conflict_write.go
- create_or_first.go
- cursor.go
- declaration.go
- encrypted_write.go
- explain.go
- extension.go
- global_scope.go
- hooks.go
- identity.go
- input_binding.go
- input_key.go
- insert_each.go
- limits.go
- lookup.go
- lookup_value.go
- model_read.go
- mutator.go
- number_key.go
- ordered.go
- pagination.go
- pagination_types.go
- projection_bridge.go
- prune.go
- query.go
- raw.go
- raw_fragment.go
- record.go
- relation.go
- relation_aggregate.go
- relation_aggregate_loading.go
- relation_expression_order.go
- relation_global_scope.go
- relation_join_plan.go
- relation_loading.go
- relation_morph.go
- relation_pivot_mutation.go
- relation_predicate.go
- relation_scope.go
- relation_through.go
- relation_through_hop.go
- relation_through_loading.go
- relation_tree.go
- relation_value.go
- relation_write.go
- relation_write_core.go
- retrieval.go
- source.go
- source_write.go
- source_write_bridge.go
- source_write_execution.go
- text_capability.go
- uuid_compare.go
- write.go
- write_atomic.go
- write_draft.go
- write_each.go
- write_keyed.go
- write_lookup.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package expr provides thin, typed SQL expressions in explicit source scopes.
|
Package expr provides thin, typed SQL expressions in explicit source scopes. |
|
internal
|
|
|
enuminit
Package enuminit deliberately declares models before generated enum variables.
|
Package enuminit deliberately declares models before generated enum variables. |
|
Package rows provides typed aliases, joins and complete row projections.
|
Package rows provides typed aliases, joins and complete row projections. |