Documentation
¶
Overview ¶
Package reader owns immutable SQL read plans and SQLX-backed execution with fresh invocation sessions, typed rows, relations, partitions, hooks, and the native SQLX cache path.
Index ¶
- Constants
- type Config
- type Execution
- func (e *Execution) PlanRead(ctx context.Context, input any, binder xhandler.Binder, ...) (*dexec.ReadPlan, error)
- func (e *Execution) PrepareQuery(ctx context.Context, input any, binder xhandler.Binder, ...) (*dexec.PreparedQuery, error)
- func (e *Execution) Read(ctx context.Context, input any, binder xhandler.Binder, ...) (any, error)
- func (e *Execution) ReadResult(ctx context.Context, input any, binder xhandler.Binder, ...) (*ReadResult, error)
- func (e *Execution) Warmup(ctx context.Context, invocation dexec.ReaderWarmupInvocation) (int, error)
- func (e *Execution) WarmupTargets() []dexec.ReaderWarmupTarget
- func (e *Execution) WithRecorder(recorder *observability.Recorder) dexec.Reader
- type Option
- type Output
- type Plan
- type PlanConfig
- type ReadResult
- type RelationPlan
- type SelectorBindingPlan
- type Service
- type Session
- type ViewDependency
- type ViewIndex
- type ViewPlan
Constants ¶
const ViewDependencyKind = "view"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Component *spec.Component
InputType reflect.Type
OutputType reflect.Type
Plan *Plan
SQL *dsql.SQLComponent
ReadCaches map[*data.View]cache.Cache
// contains filtered or unexported fields
}
Config contains immutable dependencies for a registered reader execution.
type Execution ¶
type Execution struct {
// contains filtered or unexported fields
}
Execution is a concurrency-safe registered reader. Mutable output and relation state are allocated in a fresh Session for every invocation.
func (*Execution) PrepareQuery ¶
func (*Execution) ReadResult ¶
func (e *Execution) ReadResult(ctx context.Context, input any, binder xhandler.Binder, resolver sqlx.ParameterResolver) (*ReadResult, error)
ReadResult opts one invocation into column provenance. Ordinary Read remains allocation-free with respect to this optional evidence graph.
func (*Execution) Warmup ¶
func (e *Execution) Warmup(ctx context.Context, invocation dexec.ReaderWarmupInvocation) (int, error)
Warmup prepares queries through the same reader owners as normal reads and populates the exact native SQLX cache assigned to each prepared view.
func (*Execution) WarmupTargets ¶
func (e *Execution) WarmupTargets() []dexec.ReaderWarmupTarget
func (*Execution) WithRecorder ¶
func (e *Execution) WithRecorder(recorder *observability.Recorder) dexec.Reader
WithRecorder returns a detached execution using an application-owned native metric service. Metadata and typed read plans remain immutable and shared.
type Output ¶
type Output struct {
Metrics response.Metrics
Data any
DataType reflect.Type
DataPtr any
Projection *readmeta.Result
}
Output carries typed reader output storage for one execution.
type Plan ¶
type Plan struct {
SelectorBindings []SelectorBindingPlan
ViewIndex *ViewIndex
OutputViewField string
OutputMetricsField string
OutputStatusField string
DirectOutput bool
Root *ViewPlan
// contains filtered or unexported fields
}
Plan is immutable reader execution metadata compiled during bootstrap.
func NewPlan ¶
func NewPlan(config PlanConfig) (*Plan, error)
type PlanConfig ¶
type PlanConfig struct {
SelectorBindings []SelectorBindingPlan
ViewIndex *ViewIndex
OutputViewField string
OutputMetricsField string
OutputStatusField string
DirectOutput bool
RootView *data.View
Templates map[*data.View]sqltemplate.Evaluator
Criteria map[*data.View]*criteria.Compiler
Partitioners map[*data.View]xreader.Partitioner
Collection *collector.Graph
Codecs map[*data.View]*rowcodec.Plan
}
PlanConfig contains compiler-owned inputs used to assemble one final reader plan. The temporary maps do not escape into runtime plan state.
type ReadResult ¶
ReadResult carries ordinary typed data plus optional evidence about actual mapped columns at final result ordinals. It does not change row shape.
type RelationPlan ¶
RelationPlan is one graph edge from a parent view plan to its target plan. Target may point to an existing shared node. Executable dependency edges remain acyclic; recursive row data uses the view's self-reference metadata.
type SelectorBindingPlan ¶
type SelectorBindingPlan struct {
View *data.View
Property spec.SelectorProperty
FieldIndex []int
}
SelectorBindingPlan maps an already-bound input field to a view selector property. Bindly owns value resolution; this plan only describes reader interpretation.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the rebuilt reader capability. It restores a reader-owned execution center rather than pushing read behavior back into the root runtime facade.
func NewService ¶
type Session ¶
type Session struct {
Component *spec.Component
InputType reflect.Type
OutputType reflect.Type
Artifact *Plan
SQL *dsql.SQLComponent
ReadCaches map[*data.View]cache.Cache
Parameters sqlx.ParameterResolver
CollectProjection bool
DryRun bool
RefreshCache bool
CacheOnly bool
QueryScope *sqlxread.QueryScope
Output
// contains filtered or unexported fields
}
Session contains only SQL reader execution state. Input binding, transport, handler capabilities, and registration remain runtime concerns.
type ViewDependency ¶
type ViewDependency struct {
Name string
TargetType reflect.Type
Component *spec.Component
InputType reflect.Type
Plan *Plan
}
ViewDependency is one immutable, typed independent-view read compiled from a component input binding.
type ViewIndex ¶
type ViewIndex struct {
// contains filtered or unexported fields
}
ViewIndex is the immutable registration-time index of prepared views. Aliases may be duplicated; ambiguity is reported only when that alias is selected, so unrelated repeated child names remain valid.
type ViewPlan ¶
type ViewPlan struct {
View *data.View
Template sqltemplate.Evaluator
Criteria *criteria.Compiler
Connector string
Partitioner xreader.Partitioner
Collector *collector.View
Codec *rowcodec.Plan
Relations []*RelationPlan
}
ViewPlan is immutable execution metadata for one view in a reader graph. Runtime services consume this node directly instead of joining parallel maps of view-scoped behavior on every read.
Source Files
¶
- cache_matcher.go
- dependency.go
- doc.go
- dry_run.go
- execution.go
- fetch_set.go
- hooks.go
- metrics.go
- metrics_output.go
- options.go
- output_accessors.go
- output_provenance.go
- output_relations.go
- output_selection.go
- parameter_budget.go
- partition.go
- plan.go
- provenance.go
- query.go
- relation_key_capture.go
- relation_read.go
- relation_scheduler.go
- retry.go
- row_read.go
- selector_plan.go
- selectors.go
- service.go
- session.go
- status_output.go
- view_index.go
- warmup.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package collector owns reader-compiled relation graphs and typed row assembly.
|
Package collector owns reader-compiled relation graphs and typed row assembly. |
|
Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans.
|
Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans. |
|
Package provider adapts SQL reader dependencies to Bindly providers.
|
Package provider adapts SQL reader dependencies to Bindly providers. |
|
Package readmeta carries immutable evidence from actual typed SQL reads.
|
Package readmeta carries immutable evidence from actual typed SQL reads. |
|
Package rowcodec compiles column codecs into typed SQLX scan wrappers.
|
Package rowcodec compiles column codecs into typed SQLX scan wrappers. |