plan

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 12 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 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(_ context.Context, scanned *shape.ScanResult, _ ...shape.PlanOption) (*shape.PlanResult, error)

Plan implements shape.Planner.

type Relation

type Relation struct {
	Name     string
	Holder   string
	Ref      string
	Table    string
	Kind     string
	Raw      string
	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
	Types            []*Type
	ColumnsDiscovery bool
	TypeContext      *typectx.Context
	Directives       *dqlshape.Directives
	Diagnostics      []*dqlshape.Diagnostic
}

Result is normalized shape plan produced from scan descriptors.

type State

type State struct {
	Path          string
	Name          string
	Kind          string
	In            string
	QuerySelector string
	When          string
	Scope         string
	DataType      string
	Value         string
	Required      *bool
	Async         bool
	Cacheable     *bool
	With          string
	URI           string
	ErrorCode     int
	ErrorMessage  string
	Predicates    []*StatePredicate

	TagType       reflect.Type
	EffectiveType reflect.Type
}

State is a normalized parameter field plan.

type StatePredicate

type StatePredicate struct {
	Group     int
	Name      string
	Ensure    bool
	Arguments []string
}

StatePredicate captures parameter predicate semantics from DQL declarations.

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
	Relations              []*Relation
	Holder                 string

	AllowNulls        *bool
	SelectorNamespace string
	SelectorNoLimit   *bool
	SchemaType        string
	ColumnsDiscovery  bool

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

View is a normalized view field plan.

type ViewDeclaration

type ViewDeclaration struct {
	Tag           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
}

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