plan

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package plan defines normalization and shape-planning responsibilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentRoute added in v0.38.0

type ComponentRoute struct {
	Path       string
	FieldName  string
	Type       reflect.Type
	InputType  reflect.Type
	OutputType reflect.Type
	InputName  string
	OutputName string
	ViewName   string
	SourceURL  string
	SummaryURL string
	Name       string
	RoutePath  string
	Method     string
	Connector  string
	Marshaller string
	Handler    string
	Report     *dqlshape.ReportDirective
}

type Field

type Field struct {
	Path  string
	Name  string
	Type  reflect.Type
	Index []int
}

Field is a normalized projection of scanned field metadata.

type Planner

type Planner struct{}

Planner normalizes scan descriptors into shape plan.

func New

func New() *Planner

New returns shape planner implementation.

func (*Planner) Plan

func (p *Planner) Plan(ctx context.Context, scanned *shape.ScanResult, _ ...shape.PlanOption) (*shape.PlanResult, error)

Plan implements shape.Planner.

type Relation

type Relation struct {
	Name          string
	Parent        string
	Holder        string
	Ref           string
	Table         string
	Kind          string
	Raw           string
	ColumnsConfig map[string]*ViewColumnConfig
	On            []*RelationLink
	Warnings      []string
}

Relation is normalized relation metadata extracted from DQL joins.

type RelationLink struct {
	ParentField     string
	ParentNamespace string
	ParentColumn    string
	RefField        string
	RefNamespace    string
	RefColumn       string
	Expression      string
}

RelationLink represents one parent/ref join predicate.

type Result

type Result struct {
	RootType reflect.Type
	EmbedFS  *embed.FS

	Fields           []*Field
	ByPath           map[string]*Field
	Views            []*View
	ViewsByName      map[string]*View
	States           []*State
	Components       []*ComponentRoute
	Types            []*Type
	ColumnsDiscovery bool
	Const            map[string]string
	TypeContext      *typectx.Context
	Directives       *dqlshape.Directives
	Diagnostics      []*dqlshape.Diagnostic
}

Result is normalized shape plan produced from scan descriptors.

func ResultFrom added in v0.38.0

func ResultFrom(a *shape.PlanResult) (*Result, bool)

ResultFrom extracts the typed plan result from a PlanResult. Returns (nil, false) when a is nil or contains an unexpected concrete type.

func (*Result) ShapeSpecKind added in v0.38.0

func (r *Result) ShapeSpecKind() string

ShapeSpecKind implements shape.PlanSpec.

type SelfReference added in v0.38.0

type SelfReference struct {
	Holder string
	Child  string
	Parent string
}

SelfReference captures self-join tree metadata parsed from DQL.

type State

type State struct {
	state.Parameter `yaml:",inline"`
	QuerySelector   string
	OutputDataType  string
	EmitOutput      bool
}

State is a normalized parameter field plan.

func (*State) InName added in v0.38.0

func (s *State) InName() string

func (*State) KindString added in v0.38.0

func (s *State) KindString() string

type Type

type Type struct {
	Name        string
	Alias       string
	DataType    string
	Cardinality string
	Package     string
	ModulePath  string
}

Type is normalized type metadata collected during compile.

type View

type View struct {
	Path                   string
	Name                   string
	Ref                    string
	Mode                   string
	Table                  string
	Module                 string
	Connector              string
	CacheRef               string
	Partitioner            string
	PartitionedConcurrency int
	RelationalConcurrency  int
	SQL                    string
	SQLURI                 string
	Summary                string
	SummaryURL             string
	SummaryName            string
	Relations              []*Relation
	Holder                 string

	AllowNulls             *bool
	Groupable              *bool
	SelectorNamespace      string
	SelectorLimit          *int
	SelectorNoLimit        *bool
	SelectorCriteria       *bool
	SelectorProjection     *bool
	SelectorOrderBy        *bool
	SelectorOffset         *bool
	SelectorPage           *bool
	SelectorFilterable     []string
	SelectorOrderByColumns map[string]string
	SchemaType             string
	ColumnsDiscovery       bool
	Self                   *SelfReference

	Cardinality string
	ElementType reflect.Type
	FieldType   reflect.Type
	Declaration *ViewDeclaration
}

View is a normalized view field plan.

type ViewColumnConfig added in v0.38.0

type ViewColumnConfig struct {
	DataType  string
	Tag       string
	Groupable *bool
}

ViewColumnConfig captures declaration-level per-column overrides.

type ViewDeclaration

type ViewDeclaration struct {
	Tag           string
	TypeName      string
	Dest          string
	Codec         string
	CodecArgs     []string
	HandlerName   string
	HandlerArgs   []string
	StatusCode    *int
	ErrorMessage  string
	QuerySelector string
	CacheRef      string
	Limit         *int
	Cacheable     *bool
	When          string
	Scope         string
	DataType      string
	Of            string
	Value         string
	Async         bool
	Output        bool
	Predicates    []*ViewPredicate
	ColumnsConfig map[string]*ViewColumnConfig
}

ViewDeclaration captures declaration options used to derive a view from DQL directives.

type ViewPredicate

type ViewPredicate struct {
	Name      string
	Source    string
	Ensure    bool
	Arguments []string
}

ViewPredicate captures WithPredicate / EnsurePredicate metadata.

Jump to

Keyboard shortcuts

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