writer

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Overview

Package writer provides the metadata-driven built-in mutation handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Kind   xhandler.WriteAction
	Entity reflect.Value
}

type DatabaseSnapshot

type DatabaseSnapshot struct {
	Rows     map[rowIdentity]reflect.Value
	ByRecord map[*Record][]reflect.Value
}

DatabaseSnapshot indexes Current rows by role and identity. ByRecord keeps the load order so assembled Previous relations are deterministic.

type Field

type Field struct {
	Name          string
	Column        string
	Index         []int
	Has           []int
	AutoIncrement bool
	RefDB         string
	RefTable      string
	RefColumn     string
	// contains filtered or unexported fields
}

Field is one compiled entity field.

type Frame

type Frame struct {
	Entity, Previous reflect.Value
	ExpectedToken    reflect.Value
	Fields           *presence
	Action           xhandler.WriteAction
	Record           *Record
	Parent           *Frame
	Original         xhandler.OriginalPresence
	Hook             reflect.Value
}

type FrameworkValidation

type FrameworkValidation struct{}

type Handler

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

Handler is the universal writer. Component-specific behavior is Metadata.

func New

func New(component *spec.Component, inputType, outputType reflect.Type, operation string) (*Handler, error)

func (*Handler) CaptureInput

func (h *Handler) CaptureInput(ctx context.Context, input any) (any, error)

func (*Handler) Execute

func (h *Handler) Execute(ctx context.Context, invocation rhandler.Invocation) (any, error)

func (*Handler) FinalizeOutcome

func (h *Handler) FinalizeOutcome(ctx context.Context, invocation rhandler.Invocation, _ any, outcome xhandler.Outcome) error

func (*Handler) InputType

func (h *Handler) InputType() reflect.Type

func (*Handler) OutputType

func (h *Handler) OutputType() reflect.Type

func (*Handler) RequiresReadMetadata

func (*Handler) RequiresReadMetadata() bool

type Hooks

type Hooks struct{}
type Link struct {
	Parent Field
	Child  Field
}

Link projects one parent key into its declared child foreign key.

type Metadata

type Metadata struct {
	Component        *spec.Component
	Operation        string
	InputField       int
	CurrentField     int
	OutputField      int
	EntityType       reflect.Type
	CurrentType      reflect.Type
	Table            string
	Keys             []Field
	Fields           []Field
	Sequence         *Field
	DeleteMarker     *Field
	ConcurrencyToken *Field
	Invariants       map[string][]Field
	HookType         reflect.Type
	Root             *Record
}

Metadata is the immutable, component-specific plan interpreted by Handler. It contains no generated executable phase code.

func Compile

func Compile(component *spec.Component, inputType, outputType reflect.Type, operation string) (*Metadata, error)

type MutationActions

type MutationActions struct{ Rows []*Action }

type MutationFrames

type MutationFrames struct{ Rows []*Frame }

type OriginalInput

type OriginalInput struct{ Presence map[uintptr]originalPresence }

type Program

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

Program is invocation-owned universal mutation state. The same type is used for every writer component; only Metadata and values differ.

type Record

type Record struct {
	Name             string
	Path             string
	Auxiliary        bool
	Selector         string
	EntityType       reflect.Type
	CurrentField     int
	Table            string
	Keys             []Field
	Fields           []Field
	Sequence         *Field
	DeleteMarker     *Field
	ConcurrencyToken *Field
	Invariants       map[string][]Field
	HookType         reflect.Type
	Relations        []*Relation
	// contains filtered or unexported fields
}

Record is one writable role in a component graph.

type Relation

type Relation struct {
	Field []int
	Child *Record
	Links []Link
}

Relation is one typed parent-to-child mutation edge.

type Stage

type Stage uint8

Jump to

Keyboard shortcuts

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