compiler

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans. Each graph starts with a detached spec.View snapshot owned by data.View.Spec. Enrichment updates that snapshot; only resolved SQL columns and paired field links need reader projections. Publication ends enrichment. Collector state, native caches, partitioners, templates and execution remain with their existing reader owners. This package does not parse authored DQL, register runtime components, scan rows, or execute SQL.

Index

Constants

This section is empty.

Variables

View Source
var (
	ViewSlot    = OutputSlot{OutputName: "view", FieldName: "Data"}
	StatusSlot  = OutputSlot{OutputName: "status", FieldName: "Status"}
	MetricsSlot = OutputSlot{OutputName: "metrics", FieldName: "Metrics"}
)

Functions

func Compile

func Compile(input Input) (*sqlreader.Plan, error)

func CompileSelectorBindings

func CompileSelectorBindings(component *spec.Component, inputType reflect.Type, root *data.View, bindings []bindly.BindingSpec) ([]sqlreader.SelectorBindingPlan, error)

func CompileViewDependencies

func CompileViewDependencies(input Input) ([]*sqlreader.ViewDependency, error)

CompileViewDependencies compiles independent canonical views referenced by Bindly input bindings into the same reader plans used by route reads.

func ResolveOutputField

func ResolveOutputField(component *spec.Component, outputType reflect.Type, slot OutputSlot) string

ResolveOutputField resolves the exported output-struct field backing a reserved output slot. It first honors an explicit output-kind param whose Source.Name matches the slot output name (view also accepts body), then uses the slot's conventional field when no param claims it.

Types

type Input

type Input struct {
	Const           *constant.Values
	CodecFactory    xcodec.Factory
	Component       *spec.Component
	InputType       reflect.Type
	OutputType      reflect.Type
	Bindings        []bindly.BindingSpec
	Predicate       dexec.PredicateEvaluator
	TypeLookup      func(name string) (reflect.Type, error)
	DirectViewField string
	DirectViewType  reflect.Type
	Resources       fs.FS
}

type OutputSlot

type OutputSlot struct {
	OutputName string
	FieldName  string
}

OutputSlot describes one reserved output slot: the logical output name used by `output/...` params and the conventional exported field name used when no param claims the slot explicitly.

Jump to

Keyboard shortcuts

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