executor

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlueprintLookup

type BlueprintLookup interface {
	LookupByName(name string) (*planner.BlueprintDef, error)
}

BlueprintLookup resolves blueprint definitions by name.

type FKBinding

type FKBinding struct {
	ChildField      string
	ParentBlueprint string
	ParentTable     string
	ParentField     string
	Value           any
}

FKBinding describes a single FK assignment made before an insert.

type InsertFunc

type InsertFunc = func(ctx context.Context, db, v any) (any, error)

InsertFunc is the type-erased insert function stored in BlueprintDef.

type LogEntry

type LogEntry struct {
	Step       int
	Blueprint  string
	Table      string
	Provided   bool
	FKBindings []FKBinding
}

LogEntry holds information about a single insert operation.

type NodeResult

type NodeResult struct {
	Name  string
	Value any
}

NodeResult holds the result of a single inserted node.

type Result

type Result struct {
	Root  any
	Nodes map[string]NodeResult
	Graph *graph.Graph
}

Result holds the inserted nodes after execution.

func Execute

func Execute(ctx context.Context, db any, g *graph.Graph, lookup BlueprintLookup, logFn func(LogEntry)) (*Result, error)

Execute inserts all nodes in topological order, assigning parent PKs to child FKs. If logFn is non-nil, it is called for each step in the execution order.

Jump to

Keyboard shortcuts

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