Help us shape the future of Go! Take the 2026 Go Developer Survey

planner

package
v0.3.45 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalPlanner = errors.New("internal planner error")
)

Functions

func GeomInfoFromField added in v0.3.32

func GeomInfoFromField(query *ast.Field) map[string]types.GeometryInfo

GeomInfoFromField extracts per-field geometry metadata from a GraphQL AST field. Same mechanism the IPC handler uses when building the X-Hugr-Geometry-Fields header, but returns structured types.GeometryInfo entries keyed by dotted field path ("" means the whole value).

Used by the planner to attach GeometryInfo to every ArrowTable / *JsonValue leaf it returns, so downstream consumers (RecordToJSON, IPC writer, Arrow scanner) read from a single source of truth.

Format values produced:

  • "GeoJSON" — top-level scalar Geometry return (the whole value).
  • "GeoJSONString" — nested Geometry inside a struct / row field.
  • "WKB" — not produced here; emitted on the IPC wire by the handler when it detects a raw Geometry table column. RecordToJSON discovers WKB via the Arrow extension name directly on the column, not via GeometryInfo.
  • "H3Cell" — not a geometry; returned so callers that care (like the IPC header builder) can still see the hint.

Types

type AtInfo added in v0.3.2

type AtInfo struct {
	Version   int
	Timestamp string
}

AtInfo holds time-travel parameters for DuckLake queries.

type Catalog

type Catalog interface {
	Engine(name string) (engines.Engine, error)
}

type NodeBeforeExecFunc

type NodeBeforeExecFunc func(ctx context.Context, db *db.Pool, node *QueryPlanNode) error

type NodeFunc

type NodeFunc func(node *QueryPlanNode, children Results, params []any) (string, []any, error)

type QueryPlan

type QueryPlan struct {
	Query    *ast.Field
	RootNode *QueryPlanNode

	CompiledQuery string
	Params        []any
}

func (*QueryPlan) Compile

func (p *QueryPlan) Compile() error

func (*QueryPlan) Execute

func (p *QueryPlan) Execute(ctx context.Context, db *db.Pool) (data interface{}, err error)

func (*QueryPlan) ExecuteStream added in v0.1.20

func (p *QueryPlan) ExecuteStream(ctx context.Context, db *db.Pool) (types.ArrowTable, func(), error)

func (*QueryPlan) Log

func (p *QueryPlan) Log() string

type QueryPlanNode

type QueryPlanNode struct {
	Name        string
	Query       *ast.Field
	Nodes       QueryPlanNodes
	Comment     string
	CollectFunc NodeFunc

	BeforeParamsLen int
	AddedParams     int
	Parent          *QueryPlanNode

	Before NodeBeforeExecFunc
	// contains filtered or unexported fields
}

QueryPlan represents the execution plan for a query

func (*QueryPlanNode) Compile

func (n *QueryPlanNode) Compile(parent *QueryPlanNode, res *Result) (*Result, error)

func (*QueryPlanNode) Engine

func (n *QueryPlanNode) Engine(name string) (engines.Engine, error)

func (*QueryPlanNode) Querier added in v0.1.28

func (n *QueryPlanNode) Querier() types.Querier

func (*QueryPlanNode) SchemaProvider added in v0.3.0

func (n *QueryPlanNode) SchemaProvider() catalog.Provider

func (*QueryPlanNode) TypeDefs

func (n *QueryPlanNode) TypeDefs() base.DefinitionsSource

type QueryPlanNodes

type QueryPlanNodes []*QueryPlanNode

func (*QueryPlanNodes) Add

func (n *QueryPlanNodes) Add(node *QueryPlanNode)

func (*QueryPlanNodes) ForName

func (n *QueryPlanNodes) ForName(name string) *QueryPlanNode

type Result

type Result struct {
	Name     string
	Result   string
	Params   []any
	Children Results
}

type Results

type Results []*Result

func (*Results) FirstResult

func (r *Results) FirstResult() *Result

func (*Results) ForName

func (r *Results) ForName(name string) *Result

type Service

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

func New

func New(c Catalog, q types.Querier) *Service

func (*Service) Plan

func (s *Service) Plan(ctx context.Context, provider catalog.Provider, query *ast.Field, vars map[string]interface{}) (*QueryPlan, error)

Jump to

Keyboard shortcuts

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