Documentation
¶
Overview ¶
Package data owns immutable reader projections over detached spec snapshots. spec.View is the structural metadata authority; data adds resolved bindings, SQL columns and paired relation links. Compilation may enrich an exclusively owned snapshot before publication. Invocation state and database services belong to the SQL reader and never enter these metadata objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
Name string `json:"name,omitempty"`
Warmup *spec.CacheWarmupSettings `json:"warmup,omitempty"`
// Warmups holds additional warmup definitions; the singular Warmup, when set, is always first.
Warmups []*spec.CacheWarmupSettings `json:"warmups,omitempty"`
SharedCases map[string][]*spec.CacheWarmupCase `json:"sharedCases,omitempty"`
}
func (*Cache) EffectiveWarmups ¶ added in v1.0.0
func (c *Cache) EffectiveWarmups() ([]*spec.CacheWarmupSettings, error)
EffectiveWarmups returns every normalized warmup: singular first, then plural in declaration order, each owning an expanded, detached case list.
type Column ¶
type Column struct {
Name string `json:"name"`
Column string `json:"column,omitempty"`
Expression string `json:"expression,omitempty"`
Groupable bool `json:"groupable,omitempty"`
Nullable bool `json:"nullable,omitempty"`
NullFallback string `json:"nullFallback,omitempty"`
DataType string `json:"dataType,omitempty"`
Tag string `json:"tag,omitempty"`
Codec *spec.Codec `json:"codec,omitempty"`
}
Column is immutable view-column metadata used by SQL construction and selector validation.
func (*Column) ConfigureNullability ¶ added in v1.0.0
ConfigureNullability records the scalar SQL fallback resolved during compilation. Only scalar value types receive defaults; callers must retain pointer shape rather than pass its dereferenced scalar type.
func (*Column) SelectExpression ¶ added in v1.0.0
type Link ¶ added in v1.0.0
type Link struct {
Namespace string
// Column addresses the SQL source used by a matching predicate.
Column string
// Output retains the authored result label when it differs from Column.
Output string
Field string
}
func (*Link) OutputColumn ¶ added in v1.0.0
OutputColumn is the result value required when this relation is selected.
type MatchStrategy ¶ added in v1.0.0
type MatchStrategy int
const ( MatchSequential MatchStrategy = iota MatchReadAll )
func (MatchStrategy) ReadAll ¶ added in v1.0.0
func (s MatchStrategy) ReadAll() bool
type Relation ¶ added in v1.0.0
type Relation struct {
Name string `json:"name,omitempty"`
Kind spec.RelationKind `json:"kind,omitempty"`
Holder string `json:"holder,omitempty"`
Cardinality spec.Cardinality `json:"cardinality,omitempty"`
On Links `json:"-"`
Of *RelationRef `json:"-"`
}
func (*Relation) IsComposite ¶ added in v1.0.0
type RelationRef ¶ added in v1.0.0
type RelationRef struct {
View *View
On Links
MatchStrategy MatchStrategy
}
type Relations ¶ added in v1.0.0
type Relations []*Relation
func (Relations) PopulateWithVisitor ¶ added in v1.0.0
type View ¶
type View struct {
Spec spec.View `json:"spec"`
Connector string `json:"connector,omitempty"`
Columns []*Column `json:"columns,omitempty"`
Cache *Cache `json:"cache,omitempty"`
Relations []*Relation `json:"relations,omitempty"`
CaseFormat text.CaseFormat `json:"-"`
}
View owns a detached spec snapshot plus compiled reader metadata. Compilation may enrich the snapshot; after publication the entire graph is immutable. Columns and Relations are reader projections (SQL null fallbacks and paired field links), while all other structural metadata is owned by spec.View. Execution state, collectors, partitioners and native caches live in reader.
func FromComponent ¶ added in v1.0.0
func FromView ¶ added in v1.0.0
FromView resolves one canonical view graph with component-level defaults. It is used for both the route root and independent DI-backed view reads.
func (*View) IsGroupable ¶ added in v1.0.0
IsGroupable resolves the absent authored setting to the reader default.
func (*View) NullsAllowed ¶ added in v1.0.0
NullsAllowed resolves the absent authored setting to the reader default.