column

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: 28 Imported by: 4

Documentation

Overview

Package column refines canonical view columns during explicit transcription. It delegates database metadata detection to SQLX and query rewriting to SQLParser; it owns no runtime scanner, cache, connector registry, or row map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyWriterMetadata

func ApplyWriterMetadata(component *spec.Component) error

ApplyWriterMetadata promotes explicitly authored SQLX field metadata into the canonical facts required by mutation planning. It is intentionally called only by writer generation; readers neither require nor infer identity from author tags.

func ValidateProjectionAnnotations

func ValidateProjectionAnnotations(view *spec.View, projected []string) error

ValidateProjectionAnnotations checks SQL view annotations against authoritative output names, supplied by the SQL projection or by SQLX column discovery.

Types

type Compilation added in v1.1.0

type Compilation struct {
	// contains filtered or unexported fields
}

Compilation owns metadata for one compilation's root and independent views. Catalog/schema configuration must remain stable for each *sql.DB pool during compilation. View graphs are mutated by discovery and must not be shared by concurrent compilations. A Refiner may be shared if its resolver is safe for concurrent use.

func (*Compilation) RefineRoot added in v1.1.0

func (r *Compilation) RefineRoot(ctx context.Context, component *spec.Component, resources fs.FS, input *TemplateInput) error

RefineRoot discovers the root relation tree before generated input contracts are rebuilt for parameterized independent views.

func (*Compilation) RefineViews added in v1.1.0

func (r *Compilation) RefineViews(ctx context.Context, component *spec.Component, resources fs.FS, input *TemplateInput) error

RefineViews discovers independent view trees against the rebuilt typed input.

type Connections

type Connections map[string]*sql.DB

Connections is a static connector set suitable for command composition and tests. Production composition may supply its own DBResolver.

func (Connections) ResolveDB

func (c Connections) ResolveDB(_ context.Context, name string) (*sql.DB, error)

type DBResolver

type DBResolver interface {
	ResolveDB(context.Context, string) (*sql.DB, error)
}

DBResolver resolves one configured connector for compile-time discovery.

type Refiner

type Refiner struct {
	// contains filtered or unexported fields
}

Refiner enriches canonical views with SQLX-discovered scalar columns.

func New

func New(resolver DBResolver) *Refiner

func (*Refiner) BeginCompilation added in v1.1.0

func (r *Refiner) BeginCompilation() *Compilation

BeginCompilation starts isolated metadata reuse without retaining state on r. Discard the returned object when the compilation finishes, including failures.

func (*Refiner) Refine

func (r *Refiner) Refine(ctx context.Context, component *spec.Component, resources fs.FS, input *TemplateInput) error

func (*Refiner) RefineRoot

func (r *Refiner) RefineRoot(ctx context.Context, component *spec.Component, resources fs.FS, input *TemplateInput) error

RefineRoot discovers a root relation tree with fresh metadata state. Use BeginCompilation to share metadata with a subsequent RefineViews call.

func (*Refiner) RefineViews

func (r *Refiner) RefineViews(ctx context.Context, component *spec.Component, resources fs.FS, input *TemplateInput) error

RefineViews discovers independent views with fresh metadata state.

func (*Refiner) ValidateSourceProjections

func (r *Refiner) ValidateSourceProjections(component *spec.Component, resources fs.FS) error

ValidateSourceProjections is the no-database validation path. An unresolved wildcard needs discovery; authored annotations are not evidence of outputs.

type TemplateInput

type TemplateInput struct {
	Const             *constant.Values
	Value             reflect.Value
	Variables         []sqltemplate.Variable
	ParameterResolver sqlx.ParameterResolver
	Predicate         exec.PredicateEvaluator
}

TemplateInput is the compile-time contract used to evaluate parameterized SQL before SQLX column discovery. It contains no request or runtime session.

Jump to

Keyboard shortcuts

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