compiler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package compiler converts canonical component parameters and Go input types into immutable Bindly plans and codec bindings. It does not execute handlers or compile reader plans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBindingSpecs

func BuildBindingSpecs(component *spec.Component, inputType reflect.Type, codecs map[string]ParamCodec) ([]bindly.BindingSpec, error)

BuildBindingSpecs compiles package tags and component parameter metadata into Bindly's single registration-time binding model. Component metadata overrides matching tag metadata; tags can complete an omitted source name only when both sources use the same kind.

Types

type Compiler

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

Compiler builds canonical binding metadata and route-effective input contracts from one resolved component contract.

func New

func New(input Input) *Compiler

func (*Compiler) Compile

func (c *Compiler) Compile() (*Result, error)

func (*Compiler) CompileBindings

func (c *Compiler) CompileBindings() ([]bindly.BindingSpec, error)

CompileBindings builds codec-aware binding metadata without requiring route exposure. SQL reader compilation consumes this phase directly.

type Input

type Input struct {
	Component    *spec.Component
	InputType    reflect.Type
	CodecFactory xcodec.Factory
	Resources    fs.FS
	TypeLookup   func(string) (reflect.Type, error)
}

type OutputBindingCompiler

type OutputBindingCompiler struct {
	Component *spec.Component
	Type      reflect.Type
	Kinds     []string
}

OutputBindingCompiler compiles selected runtime metadata slots through the same canonical field/tag resolver as input contracts. It creates no invocation state.

func (OutputBindingCompiler) CompileBindings

func (c OutputBindingCompiler) CompileBindings() ([]bindly.BindingSpec, error)

type ParamCodec

type ParamCodec struct {
	Instance   xcodec.Instance
	SourceType reflect.Type
}

ParamCodec keeps the provider-facing source contract beside the executable codec so plan compilation cannot discard either half of the transformation.

type ParamCodecCompiler

type ParamCodecCompiler struct {
	Component  *spec.Component
	InputType  reflect.Type
	Factory    xcodec.Factory
	Resources  fs.FS
	LookupType func(string) (reflect.Type, error)
}

ParamCodecCompiler resolves codec source contracts before constructing their executable transformations.

func (ParamCodecCompiler) Build

func (c ParamCodecCompiler) Build() (map[string]ParamCodec, error)

type Result

type Result struct {
	Bindings []bindly.BindingSpec
	Input    *registry.InputContract
}

Jump to

Keyboard shortcuts

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