data

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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 holds named reusable case sets referenced by warmup CaseRefs.
	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.

func (*Cache) HasWarmup added in v1.0.0

func (c *Cache) HasWarmup() bool

HasWarmup reports whether the cache defines a singular or plural warmup.

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

func (c *Column) ConfigureNullability(nullable bool, typeName string)

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

func (c *Column) SelectExpression(allowNulls bool) string
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 NewLink(namespace, column, field string) *Link

func (*Link) OutputColumn added in v1.0.0

func (l *Link) OutputColumn() string

OutputColumn is the result value required when this relation is selected.

type Links []*Link

func (Links) InColumnExpression added in v1.0.0

func (l Links) InColumnExpression() []string

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

func (r *Relation) IsComposite() bool

func (*Relation) IsOutput added in v1.0.0

func (r *Relation) IsOutput() bool

IsOutput reports whether the relation binds one top-level output holder rather than matching rows back to parent items.

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

func (r Relations) PopulateWithVisitor() []*Relation

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 FromComponent(component *spec.Component) *View

func FromView added in v1.0.0

func FromView(component *spec.Component, source *spec.View) *View

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

func (v *View) IsGroupable() bool

IsGroupable resolves the absent authored setting to the reader default.

func (*View) NullsAllowed added in v1.0.0

func (v *View) NullsAllowed() bool

NullsAllowed resolves the absent authored setting to the reader default.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL