golang

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: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package golang lowers semantic handler transcription plans into Go AST.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScaffoldHooks

func ScaffoldHooks(config Config) (*ast.File, error)

ScaffoldHooks creates the optional user-owned input/output lifecycle file. The generator persists it create-once and never adds it to its manifest.

func ValidateUniversalWriterPlan

func ValidateUniversalWriterPlan(value *plan.Plan, config Config) error

ValidateUniversalWriterPlan applies target-independent mutation-policy checks without generating a component-specific mutation program.

Types

type Asset

type Asset struct {
	Factory  string
	Handler  string
	File     *ast.File
	Entities *EntityAsset
}

Asset is the isolated Go AST product of one target lowering pass.

func Lower

func Lower(value *plan.Plan, config Config) (*Asset, error)

Lower builds one recursive generated write handler as Go AST.

func (*Asset) Source

func (a *Asset) Source() ([]byte, error)

Source formats the target AST using the standard Go formatter.

type Config

type Config struct {
	ReadIndexes *ReadIndexConfig
	Package     string
	// PackagePath is the canonical target import path when lowering hook type references.
	PackagePath string
	Factory     string
	Handler     string
	InputType   string
	OutputType  string
	Records     []RecordType
	Imports     []spec.ImportSpec
}

Config contains target syntax and package choices only.

type EntityAsset

type EntityAsset struct {
	File            *ast.File
	CaptureFunction string
	Methods         []EntityMethod
	SnapshotType    string
	SyncContextType string
	SyncMethod      string
	Associations    []EntityAssociation
	Invariants      []EntityInvariant
	// contains filtered or unexported fields
}

func EntitySupport

func EntitySupport(value *plan.Plan, config Config) (*EntityAsset, error)

EntitySupport emits typed original-state and setter AST for both targets.

type EntityAssociation

type EntityAssociation struct {
	Identity string
	Path     plan.FieldPath
	Field    string
	// KeyAdapterType exposes original captured identity, never working values.
	StateType, KeyType, KeyAdapterType string
	CurrentKeyFunction                 string
}

type EntityInvariant

type EntityInvariant struct {
	Identity                string
	Path                    plan.FieldPath
	Group, BackfillFunction string
}

EntityInvariant names generated backfill support for one canonical role/group.

type EntityMethod

type EntityMethod struct {
	Receiver, Name, ValueType string
	Getter                    bool
	Signature                 string
}

EntityMethod records generated public methods for authored-source ownership checks.

type MutationActionAsset

type MutationActionAsset struct {
	File     *ast.File
	TypeName string
}

MutationActionAsset is typed policy lowering, never a transaction owner.

func MutationActionSupport

func MutationActionSupport(value *plan.Plan, config Config, entities *EntityAsset, frames *MutationFrameAsset) (*MutationActionAsset, error)

type MutationFrameAsset

type MutationFrameAsset struct {
	File                                   *ast.File
	Layout                                 *MutationFrameLayout
	Previous                               *MutationPreviousAsset
	TypeName, CaptureFunction, BuildMethod string
	VerifyMethod                           string
}

MutationFrameAsset composes capture and frame preparation from the same immutable record plan. The caller captures Current before input initialization.

func MutationFrameSupport

func MutationFrameSupport(value *plan.Plan, config Config, entities *EntityAsset) (*MutationFrameAsset, error)

type MutationFrameLayout

type MutationFrameLayout struct {
	File                       *ast.File
	TypeName                   string
	Roles                      []MutationFrameRole
	OrderField, OrderEntryType string
}

MutationFrameLayout is the sole declaration owner for typed entity frames, including roles without hooks that still need invariants or database state.

func MutationFrames

func MutationFrames(value *plan.Plan, config Config) (*MutationFrameLayout, error)

type MutationFrameRole

type MutationFrameRole struct {
	Identity                                 string
	Path                                     plan.FieldPath
	FrameType, Field, EntityType, ParentType string
}

MutationFrameRole references one existing semantic role using target names. It does not define another relation or mutation policy tree.

type MutationHookAsset

type MutationHookAsset struct {
	File                 *ast.File
	TypeName, FramesType string
	Roles                []MutationHookRole
}

MutationHookAsset is a partial generated product. Its declarations/imports compose into the existing handler artifact; it does not implement Program.

func MutationHookSupport

func MutationHookSupport(value *plan.Plan, config Config, supplied ...*MutationFrameLayout) (*MutationHookAsset, error)

MutationHookSupport lowers only dependency preparation and typed Init/Validate calls. The surrounding Program owns matching/current projection and populates frames with distinct DB Previous/PreviousFields and captured OriginalPresence.

type MutationHookRole

type MutationHookRole struct {
	Identity         string
	Path             plan.FieldPath
	FrameType, Field string
}

MutationHookRole names a typed target-language frame, not a second policy tree.

type MutationInvariantAsset

type MutationInvariantAsset struct {
	File     *ast.File
	Function string
}

MutationInvariantAsset applies declared groups to the shared typed frames. It is a phase product, not a separate execution engine or complete Program.

func MutationInvariantSupport

func MutationInvariantSupport(value *plan.Plan, config Config, entities *EntityAsset, layout *MutationFrameLayout) (*MutationInvariantAsset, error)

type MutationOutputAsset

type MutationOutputAsset struct {
	File     *ast.File
	Function string
}

MutationOutputAsset projects the working request body into the declared output contract. Call before returning output, not from the error-free getter.

func MutationOutputSupport

func MutationOutputSupport(value *plan.Plan, config Config) (*MutationOutputAsset, error)

type MutationPreviousAsset

type MutationPreviousAsset struct {
	File  *ast.File
	Roles []MutationPreviousRole
}

MutationPreviousAsset freezes read rows and their actual projection evidence. It is a phase product, not an implementation of the generic Program contract.

func MutationPreviousSupport

func MutationPreviousSupport(value *plan.Plan, config Config, entities *EntityAsset) (*MutationPreviousAsset, error)

type MutationPreviousRole

type MutationPreviousRole struct {
	Identity                             string
	Path                                 plan.FieldPath
	TypeName, CaptureFunction, EntryType string
}

MutationPreviousRole describes a generated typed database snapshot product. Its identity index is deliberately separate from processing associations.

type MutationProgramAsset

type MutationProgramAsset struct {
	File                         *ast.File
	Factory, Definition, Program string
	Indexes                      *ReadIndexAsset
	Entities                     *EntityAsset
	Frames                       *MutationFrameAsset
	Hooks                        *MutationHookAsset
	Invariants                   *MutationInvariantAsset
	Actions                      *MutationActionAsset
	Validation                   *MutationValidationAsset
	Output                       *MutationOutputAsset
}

MutationProgramAsset assembles real policy phases. Support products remain separate source files in the same package; transaction completion stays in the canonical runtime adapter/engine.

func MutationProgram

func MutationProgram(value *plan.Plan, config Config) (*MutationProgramAsset, error)

func (*MutationProgramAsset) Files

func (a *MutationProgramAsset) Files() ([]*ast.File, error)

Files returns the complete generated package source products in stable order.

type MutationScaffold

type MutationScaffold struct {
	File     *ast.File
	Plan     *plan.Plan
	Bindings []MutationScaffoldBinding
}

MutationScaffold is a target proposal over a detached semantic plan. Bindings identify only newly proposed hook types; authored hooks retain their authority.

func ScaffoldMutationHooks

func ScaffoldMutationHooks(value *plan.Plan, config Config) (*MutationScaffold, error)

ScaffoldMutationHooks proposes invocation-scoped EntityHooks, never methods on the input/output contracts or foreign entity types. Self descendants use the same role's LifecycleContext, including its typed SelfParent field and the invocation-owned component Output.

type MutationScaffoldBinding

type MutationScaffoldBinding struct {
	Identity, Hook, Entity, Parent string
	Path                           plan.FieldPath
	Root                           bool
}

type MutationValidationAsset

type MutationValidationAsset struct {
	File     *ast.File
	TypeName string
}

MutationValidationAsset validates every typed frame before custom Validate hooks. It shares action selection with diff and consumes native scoped checks.

func MutationValidationSupport

func MutationValidationSupport(value *plan.Plan, config Config, entities *EntityAsset, frames *MutationFrameAsset) (*MutationValidationAsset, error)

type ReadIndexAsset

type ReadIndexAsset struct {
	File                    *ast.File
	TypeName, BuildFunction string
	PackagePath             string
	CacheField              string
}

ReadIndexAsset is application lookup syntax, separate from Previous authority.

func ReadIndexes

func ReadIndexes(value *plan.Plan, config Config) (*ReadIndexAsset, error)

ReadIndexes emits only the public typed read-index support used by input and entity hooks. It does not emit a component-specific mutation program.

type ReadIndexConfig

type ReadIndexConfig struct {
	Types                           xshape.Lookup
	Package, PackagePath, InputType string
	Owned                           bool
}

ReadIndexConfig selects the input's package authority for application helpers.

type RecordType

type RecordType struct {
	Identity string
	Path     plan.FieldPath
	Value    string
	Current  string
	// CurrentValue is the input-bound read carrier; Current names its row collection.
	// Empty means the existing direct-current collection contract.
	CurrentValue string
}

RecordType supplies target-language types after final contract and view authority resolution. Semantic plans remain target-neutral.

Source Files

Jump to

Keyboard shortcuts

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