Documentation
¶
Overview ¶
Package modeled provides builder Table, Col, and Key variants parameterized by a concrete Model, so the compiler knows which model a fragment belongs to.
Why modeled scope ¶
builder.Table, builder.Col, and builder.Key are model-agnostic: the same column name can belong to any table. modeled tells the compiler which Model owns a Table, Col, or Key.
e.g.
Table[User]: modeled table by User model. TCol[User, uint64]: column from User model and its type is uint64. Key[User]: index defined on User model.
Usage ¶
- M / CastT builds a scoped table from a model
- CastC builds a model scoped column
- CT builds a typed model scoped column
- CastK builds a model scoped index
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Col ¶
type Col[M Model] interface { ModelNewer[M] builder.Col // ComputedBy returns a copy with a computed expression. ComputedBy(frag.Fragment) Col[M] }
Col is a builder.Col bound to model type M.
type Key ¶
type Key[M Model] interface { ModelNewer[M] builder.Key ColIter[M] }
Key is a builder.Key bound to model type M.
type ModelNewer ¶
type ModelNewer[M Model] internal.ModelNewer[M]
ModelNewer constructs a model instance of type M.
type OrderAddition ¶
type OrderAddition[M Model] interface { builder.OrderAddition }
OrderAddition is a model-scoped order clause (same as builder.OrderAddition).
type TCol ¶
type TCol[M Model, T any] interface { ModelNewer[M] builder.TCol[T] // ComputedBy returns an untyped model-scoped column with a computed expression. ComputedBy(frag.Fragment) Col[M] // TypedComputedBy returns a typed model-scoped column with a computed expression. TypedComputedBy(frag.Fragment) TCol[M, T] }
TCol is a typed builder.TCol bound to model type M and value type T.
type Table ¶
type Table[M Model] interface { builder.Table ModelNewer[M] // MK picks a model-scoped key by name. MK(string) Key[M] ColIter[M] KeyIter[M] }
Table is a builder.Table bound to model type M.
func CastT ¶
CastT wraps a builder.Table as a model-scoped Table.