bindings

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: 17 Imported by: 0

Documentation

Overview

Package bindings emits and discovers P1 model-attached policy and hook bindings. Discovery is entirely static and uses go/types object identity.

Index

Constants

View Source
const (
	BindingPolicy BindingKind = "policy"
	BindingHook   BindingKind = "hook"

	OperationFindOne    HookOperation = "findOne"
	OperationFindFirst  HookOperation = "findFirst"
	OperationFindMany   HookOperation = "findMany"
	OperationCreate     HookOperation = "create"
	OperationUpdate     HookOperation = "update"
	OperationDelete     HookOperation = "delete"
	OperationUpdateMany HookOperation = "updateMany"
	OperationDeleteMany HookOperation = "deleteMany"

	PhaseBefore      HookPhase = "before"
	PhaseAfter       HookPhase = "after"
	PhaseAfterCommit HookPhase = "afterCommit"
)
View Source
const Filename = "zz_golem_bindings.gen.go"

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingKind

type BindingKind string

type DiscoveryRequest

type DiscoveryRequest struct {
	Dir                string
	ModulePath         string
	Env                []string
	Compilation        ir.CompilationIR
	Packages           []modelcodegen.PackageSpec
	ModelBootstrap     modelcodegen.Result
	GolemImportPath    string
	GenerationDigest   string
	GeneratorVersion   string
	TemplateABIVersion string
}

type Entry

type Entry struct {
	ModelID     ir.ModelID
	PackagePath string
	Receiver    string
	Method      string
	Kind        BindingKind
	Operation   HookOperation
	Phase       HookPhase
	Span        ir.SourceSpan
}

type File

type File struct {
	ImportPath  string
	PackageName string
	Path        string
	Source      []byte
}

func Emit

func Emit(request Request) ([]File, error)

Emit emits aliases, direct bridges, and the package binding accessor.

func EmitShells

func EmitShells(request Request) ([]File, error)

EmitShells emits only the aliases required for the typed discovery overlay.

type HookOperation

type HookOperation string

type HookPhase

type HookPhase string

type Request

type Request struct {
	Compilation        ir.CompilationIR
	Packages           []modelcodegen.PackageSpec
	Entries            []Entry
	GolemImportPath    string
	GenerationDigest   string
	GeneratorVersion   string
	TemplateABIVersion string
}

type Result

type Result struct {
	Files       []File
	Entries     []Entry
	Methods     []ir.AttachedMethodIR
	Diagnostics []ir.Diagnostic
}

func DiscoverAndEmit

func DiscoverAndEmit(ctx context.Context, request DiscoveryRequest) Result

Jump to

Keyboard shortcuts

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