queryplan

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package queryplan contains Golem's immutable, provider-neutral query-plan diagnostic report.

A report is evidence about a prepared typed read, not database authority. It deliberately has no SQL, bind, physical-name, cost, estimate, row, timing, provider-setting, or raw-provider-detail field. Version 1 is bounded to 32 statements, 256 nodes, node depth 32, 64 field identities per node, 64 total warnings, and 256 KiB of private canonical encoding. Reports can only be produced through Golem's validated internal planning boundary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKind

type AccessKind string
const (
	AccessKindNone        AccessKind = "none"
	AccessKindPrimaryKey  AccessKind = "primaryKey"
	AccessKindUniqueIndex AccessKind = "uniqueIndex"
	AccessKindIndex       AccessKind = "index"
	AccessKindBitmapIndex AccessKind = "bitmapIndex"
	AccessKindFullScan    AccessKind = "fullScan"
	AccessKindConstant    AccessKind = "constant"
	AccessKindUnknown     AccessKind = "unknown"
)

type ErrorCode

type ErrorCode string

ErrorCode is the closed query-plan failure classification.

const (
	ErrorUnavailable ErrorCode = "PLAN_UNAVAILABLE"
	ErrorTooComplex  ErrorCode = "PLAN_TOO_COMPLEX"
	ErrorInvalid     ErrorCode = "PLAN_INVALID"
)

func CodeOf

func CodeOf(err error) (ErrorCode, bool)

CodeOf recognizes a query-plan failure through ordinary Go error wrapping. It never classifies an error from its public text.

type IndexID

type IndexID [16]byte

IndexID is the stable logical identity of a provider access object. It is a report identity only and grants no query or provider capability.

type Node

type Node internalreport.Node

func (Node) Access

func (node Node) Access() AccessKind

func (Node) BatchCapacity

func (node Node) BatchCapacity() (uint32, bool)

func (Node) Children

func (node Node) Children() []Node

func (Node) FieldIDs

func (node Node) FieldIDs() []golem.FieldID

func (Node) IndexID

func (node Node) IndexID() (IndexID, bool)

func (Node) Kind

func (node Node) Kind() NodeKind

func (Node) MaximumExecutionStatements

func (node Node) MaximumExecutionStatements() (uint32, bool)

func (Node) MinimumExecutionStatements

func (node Node) MinimumExecutionStatements() (uint32, bool)

func (Node) ModelID

func (node Node) ModelID() (golem.ModelID, bool)

func (Node) RelationID

func (node Node) RelationID() (golem.RelationID, bool)

func (Node) Warnings

func (node Node) Warnings() []Warning

type NodeKind

type NodeKind string
const (
	NodeKindAccess             NodeKind = "access"
	NodeKindJoin               NodeKind = "join"
	NodeKindSort               NodeKind = "sort"
	NodeKindAggregate          NodeKind = "aggregate"
	NodeKindMaterialize        NodeKind = "materialize"
	NodeKindCorrelatedRelation NodeKind = "correlatedRelation"
	NodeKindDeferredBatch      NodeKind = "deferredBatch"
	NodeKindConstant           NodeKind = "constant"
	NodeKindUnknown            NodeKind = "unknown"
)

type Operation

type Operation string
const (
	OperationFindUnique      Operation = "findUnique"
	OperationFindFirst       Operation = "findFirst"
	OperationFindMany        Operation = "findMany"
	OperationCount           Operation = "count"
	OperationAggregate       Operation = "aggregate"
	OperationGroupBy         Operation = "groupBy"
	OperationRelationGroupBy Operation = "relationGroupBy"
	OperationScoped          Operation = "scoped"
)

type Report

type Report internalreport.Report

Report is an immutable closed query-plan diagnostic. Its zero value is the invalid report returned alongside a failed explain operation.

func (Report) CanonicalDigest

func (report Report) CanonicalDigest() [32]byte

func (Report) FormatVersion

func (report Report) FormatVersion() uint16

func (Report) MaximumExecutionStatements

func (report Report) MaximumExecutionStatements() uint32

func (Report) MinimumExecutionStatements

func (report Report) MinimumExecutionStatements() uint32

func (Report) Operation

func (report Report) Operation() Operation

func (Report) Provider

func (report Report) Provider() golem.Provider

func (Report) RootModelID

func (report Report) RootModelID() golem.ModelID

func (Report) Statements

func (report Report) Statements() []Statement

func (Report) Warnings

func (report Report) Warnings() []Warning

type Statement

type Statement internalreport.Statement

func (Statement) Ordinal

func (statement Statement) Ordinal() uint32

func (Statement) Purpose

func (statement Statement) Purpose() StatementPurpose

func (Statement) Root

func (statement Statement) Root() Node

type StatementPurpose

type StatementPurpose string
const (
	StatementPurposeRoot            StatementPurpose = "root"
	StatementPurposeRelationBatch   StatementPurpose = "relationBatch"
	StatementPurposePolicyHydration StatementPurpose = "policyHydration"
	StatementPurposeAnalytics       StatementPurpose = "analytics"
	StatementPurposeScoped          StatementPurpose = "scoped"
)

type Warning

type Warning string
const (
	WarningFullScan            Warning = "FULL_SCAN"
	WarningTemporarySort       Warning = "TEMPORARY_SORT"
	WarningMaterialization     Warning = "MATERIALIZATION"
	WarningDeferredBatch       Warning = "DEFERRED_BATCH"
	WarningMultiStatement      Warning = "MULTI_STATEMENT"
	WarningUnknownProviderNode Warning = "UNKNOWN_PROVIDER_NODE"
)

Jump to

Keyboard shortcuts

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