field

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package field defines the stored values, validation, access rules, hooks, and admin presentation of fields in Ridu collections and globals. Build a Fields value from constructors such as Text, Number, Select, Group, and Array, then assign it to ridu.Collection.Fields, ridu.Global.Fields, or a nested field.

Constructors return concrete field values with fluent methods. Every method returns a refined copy, so a reusable field factory can be renamed, nested, or extended without changing the original. Access, Hooks, and Admin group related behavior; callbacks use occurrence-bound contexts from the operation package. Validate runs on authoritative saves. LiveValidate separately opts a writable field into advisory admin feedback without executing defaults or save hooks.

Text and Number configure scalar values. TextList and NumberList configure ordered primitive slices, preserving duplicates and meaningful empty/zero items. Their typed callbacks receive []string and []float64 respectively; the whole list is one field occurrence. Use Array for rows with child fields and stable identities, or MultiSelect for a list drawn from fixed options.

Use Fields.Edit for checked changes to a reusable field graph. Snapshot returns a detached View for inspecting a Node without exposing mutable configuration. Nested-field constructors and Fields.Edit snapshot their inputs. A top-level Fields slice remains caller-owned until config resolution, which snapshots the complete graph so later slice or map changes cannot alter the published schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendChild added in v0.2.0

func AppendChild[Parent interface {
	Node
	EditChildren(func(*ChildrenDraft) error) (Parent, error)
}](parent Parent, child Node) (Parent, error)

AppendChild appends one direct child to a group or array. It snapshots the child and preserves existing parent and child policies. Duplicate or invalid names return the original parent and an error.

func EditChild added in v0.2.0

func EditChild[Parent interface {
	Node
	EditChildren(func(*ChildrenDraft) error) (Parent, error)
}, Child Node](parent Parent, name string, as func(Node) (Child, error), edit func(Child) Child) (Parent, error)

EditChild refines one direct child of a group or array while retaining the parent's concrete type. Pass a checked converter such as AsText or AsSelect and return the refined field from edit. Existing policies and attachments remain on that field unless the edit explicitly replaces them.

A missing child, incompatible concrete kind, or attempted rename returns the original parent and an error. Use EditChildren for nested or multiple edits.

func NormalizeSlug

func NormalizeSlug(value string) string

NormalizeSlug converts a source or manual value into Ridu's deterministic URL-segment form. ASCII letters are lowercased, digits and underscores are retained, whitespace and hyphen runs become one hyphen, and other characters are removed.

func ReplaceChild added in v0.2.0

func ReplaceChild[Parent interface {
	Node
	EditChildren(func(*ChildrenDraft) error) (Parent, error)
}](parent Parent, name string, replacement Node) (Parent, error)

ReplaceChild deliberately replaces one direct child, including its kind, policies, and attachments. Unrelated children and the parent's own policies are preserved. A failed replacement returns the original parent and an error.

Types

type Access added in v0.2.0

type Access struct {
	// Create controls whether the field may be supplied during document creation.
	Create AccessRule
	// Read controls whether the field is included in API and admin responses.
	Read AccessRule
	// Update controls whether the field may be changed on an existing document.
	Update AccessRule
}

Access configures who may create, read, or update a field value. Assign it with a concrete field's Access method; an omitted rule leaves that operation unrestricted. Access replaces the field's complete policy group, while RestrictAccess adds only the supplied rules and requires both old and new rules to allow the operation.

For example, this field is omitted from anonymous read responses:

field.Text("internalNotes").Access(field.Access{
	Read: func(ctx operation.Context) (bool, error) {
		return ctx.Actor != nil, nil
	},
})

type AccessRule added in v0.2.0

type AccessRule func(operation.Context) (bool, error)

AccessRule decides whether one field value may be created, read, or updated. Return false during a write to reject the operation, or during a read to omit the field from the response. Returning an error stops the operation. Field rules cannot return the query predicates supported by collection access rules.

type Admin added in v0.2.0

type Admin struct {
	Description             string
	DescriptionTranslations map[string]string
	Placeholder             string
	PlaceholderTranslations map[string]string
	ReadOnly                bool
	Hidden                  bool
	Sidebar                 bool
	Columns                 int
	Editor                  ComponentRef
	RowLabel                ComponentRef
	RowLabelPath            string
	RowLabels               RowLabels
	LabelTranslations       map[string]string
	Tab                     string
	TabTranslations         map[string]string
	InitiallyCollapsed      bool
	CodeLanguage            string
	Extensions              map[string]store.Value
	// VisibleWhen is a finite presentation condition; it never grants access.
	VisibleWhen Condition
}

Admin configures how a field is presented and edited in the framework admin. It never grants API access or changes storage behavior; use Access for authorization. A field's Admin method replaces the complete group, while EditAdmin preserves members its callback does not change. Ridu snapshots maps on input and output so retained drafts cannot mutate a published field.

type ArrayField added in v0.2.0

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

ArrayField configures an ordered list of rows containing the supplied fields.

func Array

func Array(name string, children Fields) ArrayField

Array creates an ordered list of rows containing the supplied fields.

func AsArray added in v0.2.0

func AsArray(node Node) (ArrayField, error)

AsArray provides a checked concrete view of an immutable node.

func (ArrayField) Access added in v0.2.0

func (f ArrayField) Access(value Access) ArrayField

Access replaces the complete field access policy.

func (ArrayField) AccessPolicy added in v0.2.0

func (v ArrayField) AccessPolicy() Access

func (ArrayField) Admin added in v0.2.0

func (f ArrayField) Admin(value Admin) ArrayField

Admin replaces the complete admin presentation policy.

func (ArrayField) AdminPolicy added in v0.2.0

func (v ArrayField) AdminPolicy() Admin

func (ArrayField) AfterRead added in v0.2.2

func (f ArrayField) AfterRead(callbacks ...OutputTransform[store.Value]) ArrayField

AfterRead appends response transforms in order; no callbacks does nothing.

func (ArrayField) AfterReadHooks added in v0.2.2

func (f ArrayField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (ArrayField) AppendHooks added in v0.2.0

func (f ArrayField) AppendHooks(value Hooks[store.Value]) ArrayField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (ArrayField) BehaviorSummary added in v0.2.0

func (v ArrayField) BehaviorSummary() PolicySummary

func (ArrayField) Children added in v0.2.0

func (v ArrayField) Children() Fields

func (ArrayField) EditAdmin added in v0.2.0

func (f ArrayField) EditAdmin(edit func(*Admin)) ArrayField

EditAdmin updates selected admin settings while preserving the rest.

func (ArrayField) EditChildren added in v0.2.0

func (f ArrayField) EditChildren(edit func(*ChildrenDraft) error) (ArrayField, error)

func (ArrayField) HookPolicy added in v0.2.0

func (f ArrayField) HookPolicy() Hooks[store.Value]

func (ArrayField) Hooks added in v0.2.0

func (f ArrayField) Hooks(value Hooks[store.Value]) ArrayField

Hooks replaces the complete field lifecycle hook group.

func (ArrayField) IsLocalized added in v0.2.0

func (v ArrayField) IsLocalized() bool

func (ArrayField) IsRequired added in v0.2.0

func (v ArrayField) IsRequired() bool

func (ArrayField) Kind added in v0.2.0

func (v ArrayField) Kind() Kind

func (ArrayField) Label added in v0.2.0

func (f ArrayField) Label(value string) ArrayField

func (ArrayField) LabelText added in v0.2.0

func (v ArrayField) LabelText() string

func (ArrayField) LabelTranslations added in v0.2.0

func (f ArrayField) LabelTranslations(values map[string]string) ArrayField

func (ArrayField) LiveValidate added in v0.2.0

func (f ArrayField) LiveValidate(value LiveValidator[store.Value]) ArrayField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (ArrayField) LiveValidators added in v0.2.0

func (f ArrayField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (ArrayField) Localized added in v0.2.0

func (f ArrayField) Localized(values ...bool) ArrayField

func (ArrayField) MaxRows added in v0.2.0

func (f ArrayField) MaxRows(value int) ArrayField

func (ArrayField) MinRows added in v0.2.0

func (f ArrayField) MinRows(value int) ArrayField

func (ArrayField) Name added in v0.2.0

func (v ArrayField) Name() string

func (ArrayField) PrependHooks added in v0.2.0

func (f ArrayField) PrependHooks(value Hooks[store.Value]) ArrayField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (ArrayField) Private added in v0.2.0

func (f ArrayField) Private(namespace string, value store.Value) ArrayField

func (ArrayField) Provenance added in v0.2.0

func (v ArrayField) Provenance() []string

func (ArrayField) Rename added in v0.2.0

func (f ArrayField) Rename(name string) ArrayField

func (ArrayField) ReplaceAfterRead added in v0.2.2

func (f ArrayField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) ArrayField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (ArrayField) ReplaceLiveValidators added in v0.2.0

func (f ArrayField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) ArrayField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (ArrayField) ReplaceValidators added in v0.2.0

func (f ArrayField) ReplaceValidators(values ...Validator[store.Value]) ArrayField

ReplaceValidators replaces all authoritative save validators.

func (ArrayField) Required added in v0.2.0

func (f ArrayField) Required(values ...bool) ArrayField

func (ArrayField) RestrictAccess added in v0.2.0

func (f ArrayField) RestrictAccess(value Access) ArrayField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (ArrayField) Validate added in v0.2.0

func (f ArrayField) Validate(value Validator[store.Value]) ArrayField

Validate appends one authoritative save validator.

func (ArrayField) Validators added in v0.2.0

func (f ArrayField) Validators() []Validator[store.Value]

type Block

type Block struct {
	// TypeName optionally names a reusable generated type family; it never changes the stored slug.
	TypeName string
	// Slug is the stable discriminator stored with block values.
	Slug string
	// Labels overrides the singular and plural names shown to authors.
	Labels BlockLabels
	// Fields defines the values stored by this block type.
	Fields Fields
	// Admin configures this block type in the framework admin.
	Admin BlockAdmin
}

Block is one discriminated layout allowed by a blocks field.

func (Block) Snapshot added in v0.2.0

func (block Block) Snapshot() Block

Snapshot returns a detached block, copying child fields and label translations. Executable callbacks retain their original behavior.

type BlockAdmin added in v0.2.0

type BlockAdmin struct {
	// NameField names a direct stored Text child edited from the block header.
	// Slug fields and fields with custom editors are not eligible.
	NameField string
	// RowLabelPath names a direct stored scalar child; empty values use the block type label.
	RowLabelPath string
}

BlockAdmin configures ordinary and embedded block headers.

type BlockLabels added in v0.2.0

type BlockLabels struct {
	Singular             string
	Plural               string
	SingularTranslations map[string]string
	PluralTranslations   map[string]string
}

BlockLabels overrides the singular and plural names derived from a block slug. Translations select admin interface language, independently of content locale.

type BlockRegistry added in v0.2.0

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

BlockRegistry owns immutable, centrally declared block definitions. Bind makes references traversable without granting a referencing resource mutation rights.

func NewBlockRegistry added in v0.2.0

func NewBlockRegistry(blocks ...Block) (BlockRegistry, error)

NewBlockRegistry snapshots and resolves a finite registry. Forward references are supported; cycles and duplicate declarations are configuration errors.

func (BlockRegistry) Bind added in v0.2.0

func (r BlockRegistry) Bind(fields Fields) (Fields, error)

Bind returns a detached field graph with read-only referenced branches. Policy closures remain application-owned and execute normally per occurrence.

func (BlockRegistry) BindAt added in v0.2.0

func (r BlockRegistry) BindAt(fields Fields, path string) (Fields, error)

BindAt includes the resource's authored path in reference diagnostics.

func (BlockRegistry) Blocks added in v0.2.0

func (r BlockRegistry) Blocks() []Block

Blocks returns detached declarations in registration order.

type BlocksField added in v0.2.0

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

BlocksField configures an ordered list of rows chosen from the supplied block types.

func AsBlocks added in v0.2.0

func AsBlocks(node Node) (BlocksField, error)

AsBlocks provides a checked concrete view of an immutable node.

func Blocks

func Blocks(name string, blocks ...Block) BlocksField

Blocks creates an ordered list of rows chosen from the supplied block types.

func (BlocksField) Access added in v0.2.0

func (f BlocksField) Access(value Access) BlocksField

Access replaces the complete field access policy.

func (BlocksField) AccessPolicy added in v0.2.0

func (v BlocksField) AccessPolicy() Access

func (BlocksField) Admin added in v0.2.0

func (f BlocksField) Admin(value Admin) BlocksField

Admin replaces the complete admin presentation policy.

func (BlocksField) AdminPolicy added in v0.2.0

func (v BlocksField) AdminPolicy() Admin

func (BlocksField) AfterRead added in v0.2.2

func (f BlocksField) AfterRead(callbacks ...OutputTransform[store.Value]) BlocksField

AfterRead appends response transforms in order; no callbacks does nothing.

func (BlocksField) AfterReadHooks added in v0.2.2

func (f BlocksField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (BlocksField) AppendHooks added in v0.2.0

func (f BlocksField) AppendHooks(value Hooks[store.Value]) BlocksField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (BlocksField) BehaviorSummary added in v0.2.0

func (v BlocksField) BehaviorSummary() PolicySummary

func (BlocksField) Children added in v0.2.0

func (v BlocksField) Children() Fields

func (BlocksField) EditAdmin added in v0.2.0

func (f BlocksField) EditAdmin(edit func(*Admin)) BlocksField

EditAdmin updates selected admin settings while preserving the rest.

func (BlocksField) EditBlocks added in v0.2.0

func (f BlocksField) EditBlocks(edit func(*[]Block) error) (BlocksField, error)

EditBlocks edits a detached block declaration slice and publishes it only when the edit succeeds. Field-owned behavior and presentation are preserved.

func (BlocksField) HookPolicy added in v0.2.0

func (f BlocksField) HookPolicy() Hooks[store.Value]

func (BlocksField) Hooks added in v0.2.0

func (f BlocksField) Hooks(value Hooks[store.Value]) BlocksField

Hooks replaces the complete field lifecycle hook group.

func (BlocksField) IsLocalized added in v0.2.0

func (v BlocksField) IsLocalized() bool

func (BlocksField) IsRequired added in v0.2.0

func (v BlocksField) IsRequired() bool

func (BlocksField) Kind added in v0.2.0

func (v BlocksField) Kind() Kind

func (BlocksField) Label added in v0.2.0

func (f BlocksField) Label(value string) BlocksField

func (BlocksField) LabelText added in v0.2.0

func (v BlocksField) LabelText() string

func (BlocksField) LabelTranslations added in v0.2.0

func (f BlocksField) LabelTranslations(values map[string]string) BlocksField

func (BlocksField) LiveValidate added in v0.2.0

func (f BlocksField) LiveValidate(value LiveValidator[store.Value]) BlocksField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (BlocksField) LiveValidators added in v0.2.0

func (f BlocksField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (BlocksField) Localized added in v0.2.0

func (f BlocksField) Localized(values ...bool) BlocksField

func (BlocksField) MaxRows added in v0.2.0

func (f BlocksField) MaxRows(value int) BlocksField

func (BlocksField) MinRows added in v0.2.0

func (f BlocksField) MinRows(value int) BlocksField

func (BlocksField) Name added in v0.2.0

func (v BlocksField) Name() string

func (BlocksField) PrependHooks added in v0.2.0

func (f BlocksField) PrependHooks(value Hooks[store.Value]) BlocksField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (BlocksField) Private added in v0.2.0

func (f BlocksField) Private(namespace string, value store.Value) BlocksField

func (BlocksField) Provenance added in v0.2.0

func (v BlocksField) Provenance() []string

func (BlocksField) References added in v0.2.0

func (f BlocksField) References(slugs ...string) BlocksField

References selects registered definitions in picker order. Inline declarations and references are mutually exclusive and validated during resolution.

func (BlocksField) Rename added in v0.2.0

func (f BlocksField) Rename(name string) BlocksField

func (BlocksField) ReplaceAfterRead added in v0.2.2

func (f BlocksField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) BlocksField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (BlocksField) ReplaceLiveValidators added in v0.2.0

func (f BlocksField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) BlocksField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (BlocksField) ReplaceValidators added in v0.2.0

func (f BlocksField) ReplaceValidators(values ...Validator[store.Value]) BlocksField

ReplaceValidators replaces all authoritative save validators.

func (BlocksField) Required added in v0.2.0

func (f BlocksField) Required(values ...bool) BlocksField

func (BlocksField) RestrictAccess added in v0.2.0

func (f BlocksField) RestrictAccess(value Access) BlocksField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (BlocksField) Validate added in v0.2.0

func (f BlocksField) Validate(value Validator[store.Value]) BlocksField

Validate appends one authoritative save validator.

func (BlocksField) Validators added in v0.2.0

func (f BlocksField) Validators() []Validator[store.Value]

type Boundary added in v0.2.0

type Boundary string

Boundary distinguishes storage shape from presentation and embedded hosts.

const (
	StoredScalar     Boundary = "stored_scalar"
	StoredReference  Boundary = "stored_reference"
	StoredObject     Boundary = "stored_object"
	RepeatedArray    Boundary = "repeated_array"
	BlockSet         Boundary = "blocks"
	BlockCase        Boundary = "block_case"
	NamedTabBoundary Boundary = "named_tab"
	Layout           Boundary = "layout"
	PluginValue      Boundary = "plugin_value"
	EmbeddedCase     Boundary = "embedded_case"
	Output           Boundary = "output"
)

type Branch added in v0.2.0

type Branch struct {
	Selector   BranchSelector
	Name       string
	Referenced bool
	Fields     Fields
}

Branch is a detached traversal view of one child scope.

type BranchSelector added in v0.2.0

type BranchSelector struct {
	Boundary Boundary
	Index    int
	Tree     string
	Case     string
	Slug     string
}

BranchSelector selects one structural child boundary, never a flattened path. Index identifies an authored tab; Tree/Case/Key identify plugin payload cases.

type Category

type Category string

Category describes the broad behavior a field contributes to a resolved schema. Schema manifests use categories to avoid treating every field as an unstructured type string.

const (
	CategoryScalar       Category = "scalar"
	CategoryNested       Category = "nested"
	CategoryPresentation Category = "presentation"
	CategoryRelationship Category = "relationship"
	CategoryUpload       Category = "upload"
	CategoryPlugin       Category = "plugin"
)

type CheckboxField added in v0.2.0

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

CheckboxField configures a true-or-false checkbox field.

func AsCheckbox added in v0.2.0

func AsCheckbox(node Node) (CheckboxField, error)

AsCheckbox provides a checked concrete view of an immutable node.

func Checkbox

func Checkbox(name string) CheckboxField

Checkbox creates a true-or-false checkbox field.

func (CheckboxField) Access added in v0.2.0

func (f CheckboxField) Access(value Access) CheckboxField

Access replaces the complete field access policy.

func (CheckboxField) AccessPolicy added in v0.2.0

func (v CheckboxField) AccessPolicy() Access

func (CheckboxField) Admin added in v0.2.0

func (f CheckboxField) Admin(value Admin) CheckboxField

Admin replaces the complete admin presentation policy.

func (CheckboxField) AdminPolicy added in v0.2.0

func (v CheckboxField) AdminPolicy() Admin

func (CheckboxField) AfterRead added in v0.2.2

func (f CheckboxField) AfterRead(callbacks ...OutputTransform[bool]) CheckboxField

AfterRead appends response transforms in order; no callbacks does nothing.

func (CheckboxField) AfterReadHooks added in v0.2.2

func (f CheckboxField) AfterReadHooks() []OutputTransform[bool]

AfterReadHooks returns a detached response-transform slice.

func (CheckboxField) AppendHooks added in v0.2.0

func (f CheckboxField) AppendHooks(value Hooks[bool]) CheckboxField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (CheckboxField) BehaviorSummary added in v0.2.0

func (v CheckboxField) BehaviorSummary() PolicySummary

func (CheckboxField) Children added in v0.2.0

func (v CheckboxField) Children() Fields

func (CheckboxField) Default added in v0.2.0

func (f CheckboxField) Default(value bool) CheckboxField

func (CheckboxField) DefaultCallback added in v0.2.0

func (f CheckboxField) DefaultCallback() DefaultFunc[bool]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (CheckboxField) DefaultFrom added in v0.2.0

func (f CheckboxField) DefaultFrom(callback DefaultFunc[bool]) CheckboxField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (CheckboxField) EditAdmin added in v0.2.0

func (f CheckboxField) EditAdmin(edit func(*Admin)) CheckboxField

EditAdmin updates selected admin settings while preserving the rest.

func (CheckboxField) HookPolicy added in v0.2.0

func (f CheckboxField) HookPolicy() Hooks[bool]

func (CheckboxField) Hooks added in v0.2.0

func (f CheckboxField) Hooks(value Hooks[bool]) CheckboxField

Hooks replaces the complete field lifecycle hook group.

func (CheckboxField) Index added in v0.2.0

func (f CheckboxField) Index(values ...bool) CheckboxField

func (CheckboxField) IsLocalized added in v0.2.0

func (v CheckboxField) IsLocalized() bool

func (CheckboxField) IsRequired added in v0.2.0

func (v CheckboxField) IsRequired() bool

func (CheckboxField) Kind added in v0.2.0

func (v CheckboxField) Kind() Kind

func (CheckboxField) Label added in v0.2.0

func (f CheckboxField) Label(value string) CheckboxField

func (CheckboxField) LabelText added in v0.2.0

func (v CheckboxField) LabelText() string

func (CheckboxField) LabelTranslations added in v0.2.0

func (f CheckboxField) LabelTranslations(values map[string]string) CheckboxField

func (CheckboxField) LiveValidate added in v0.2.0

func (f CheckboxField) LiveValidate(value LiveValidator[bool]) CheckboxField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (CheckboxField) LiveValidators added in v0.2.0

func (f CheckboxField) LiveValidators() []LiveValidator[bool]

LiveValidators returns a detached list of this field's advisory server checks.

func (CheckboxField) Localized added in v0.2.0

func (f CheckboxField) Localized(values ...bool) CheckboxField

func (CheckboxField) Name added in v0.2.0

func (v CheckboxField) Name() string

func (CheckboxField) PrependHooks added in v0.2.0

func (f CheckboxField) PrependHooks(value Hooks[bool]) CheckboxField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (CheckboxField) Private added in v0.2.0

func (f CheckboxField) Private(namespace string, value store.Value) CheckboxField

func (CheckboxField) Provenance added in v0.2.0

func (v CheckboxField) Provenance() []string

func (CheckboxField) Rename added in v0.2.0

func (f CheckboxField) Rename(name string) CheckboxField

func (CheckboxField) ReplaceAfterRead added in v0.2.2

func (f CheckboxField) ReplaceAfterRead(callbacks ...OutputTransform[bool]) CheckboxField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (CheckboxField) ReplaceLiveValidators added in v0.2.0

func (f CheckboxField) ReplaceLiveValidators(values ...LiveValidator[bool]) CheckboxField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (CheckboxField) ReplaceValidators added in v0.2.0

func (f CheckboxField) ReplaceValidators(values ...Validator[bool]) CheckboxField

ReplaceValidators replaces all authoritative save validators.

func (CheckboxField) Required added in v0.2.0

func (f CheckboxField) Required(values ...bool) CheckboxField

func (CheckboxField) RestrictAccess added in v0.2.0

func (f CheckboxField) RestrictAccess(value Access) CheckboxField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (CheckboxField) Unique added in v0.2.0

func (f CheckboxField) Unique(values ...bool) CheckboxField

func (CheckboxField) Validate added in v0.2.0

func (f CheckboxField) Validate(value Validator[bool]) CheckboxField

Validate appends one authoritative save validator.

func (CheckboxField) Validators added in v0.2.0

func (f CheckboxField) Validators() []Validator[bool]

type ChildrenDraft added in v0.2.0

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

ChildrenDraft owns a detached slice. Committing snapshots again, so retained drafts cannot mutate published graphs. Structural edits are explicit.

func (*ChildrenDraft) EditBlock added in v0.2.0

func (d *ChildrenDraft) EditBlock(name, slug string, edit func(*ChildrenDraft) error) error

func (*ChildrenDraft) EditBranch added in v0.2.0

func (d *ChildrenDraft) EditBranch(name string, selector BranchSelector, edit func(*ChildrenDraft) error) error

EditBranch targets an explicit object, row, block case, tab or embedded case.

func (*ChildrenDraft) EditBranchAt added in v0.2.0

func (d *ChildrenDraft) EditBranchAt(index int, selector BranchSelector, edit func(*ChildrenDraft) error) error

EditBranchAt addresses a layout by its authored position when names are absent or ambiguous. The selector still identifies a structural boundary.

func (*ChildrenDraft) EditChildren added in v0.2.0

func (d *ChildrenDraft) EditChildren(name string, edit func(*ChildrenDraft) error) error

EditChildren targets the one direct children branch of an object/array/layout. Blocks, tabs and embedded payloads require their explicit branch selector.

func (*ChildrenDraft) EditNumber added in v0.2.0

func (d *ChildrenDraft) EditNumber(name string, edit func(NumberField) NumberField) error

EditNumber refines a known numeric node and diagnoses incompatible kinds.

func (*ChildrenDraft) EditNumberList added in v0.2.0

func (d *ChildrenDraft) EditNumberList(name string, edit func(NumberListField) NumberListField) error

EditNumberList refines a direct primitive-list child while preserving its policies.

func (*ChildrenDraft) EditText added in v0.2.0

func (d *ChildrenDraft) EditText(name string, edit func(TextField) TextField) error

EditText refines the actual node, preserving hidden attachments.

func (*ChildrenDraft) EditTextList added in v0.2.0

func (d *ChildrenDraft) EditTextList(name string, edit func(TextListField) TextListField) error

EditTextList refines a direct primitive-list child while preserving its policies.

func (*ChildrenDraft) Fields added in v0.2.0

func (d *ChildrenDraft) Fields() Fields

Fields returns a detached inspection snapshot of the draft's current state.

func (*ChildrenDraft) Insert added in v0.2.0

func (d *ChildrenDraft) Insert(index int, node Node) error

func (*ChildrenDraft) Remove added in v0.2.0

func (d *ChildrenDraft) Remove(name string) error

func (*ChildrenDraft) Rename added in v0.2.0

func (d *ChildrenDraft) Rename(name, replacement string) error

Rename changes one direct local name. Sibling references in this same stored scope are rebound explicitly; root references require RenameRoot at the root. Calling Rename on a facade merely changes that value's own name.

func (*ChildrenDraft) RenameRoot added in v0.2.0

func (d *ChildrenDraft) RenameRoot(name, replacement string) error

RenameRoot is the explicit root edit that also rewrites root selectors in descendants. It must be used on the resource's root draft.

func (*ChildrenDraft) Replace added in v0.2.0

func (d *ChildrenDraft) Replace(name string, node Node) error

Replace deliberately replaces a whole node, including behavior and kind.

func (*ChildrenDraft) ReplaceAt added in v0.2.0

func (d *ChildrenDraft) ReplaceAt(index int, node Node) error

ReplaceAt deliberately replaces an authored child position, including unnamed or same-named layout wrappers. It never merges or reconstructs a node.

type ComponentRef added in v0.2.0

type ComponentRef struct {
	Key       string
	PluginKey string
	Config    store.Value
	// contains filtered or unexported fields
}

ComponentRef selects a custom admin component and its optional settings. It changes the UI without changing how the field's value is stored or typed.

func Component added in v0.2.0

func Component(key string, config ...store.Value) ComponentRef

Component selects an application component registered in admin/src/admin.config.ts. Optionally pass a settings object; the component registration must provide a decoder to check it. Omit settings when the component does not use them.

func PluginComponent added in v0.2.0

func PluginComponent(pluginKey, key string, config ...store.Value) ComponentRef

PluginComponent selects a component supplied by an installed plugin. pluginKey names the Go plugin; key names a component registered by its admin package.

func (ComponentRef) Err added in v0.2.0

func (c ComponentRef) Err() error

Err validates static component syntax and finite public object configuration. Omitted configuration is allowed; explicitly supplied zero or null values are not objects. Registration and supported host checks belong to configuration resolution.

func (ComponentRef) MarshalJSON added in v0.2.0

func (c ComponentRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes only public static component data. An unspecified reference is null and absent configuration is omitted.

type Condition

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

Condition is an immutable, deterministic presentation expression. It never grants access or removes a hidden value from a document.

func All

func All(conditions ...Condition) Condition

All requires every child condition to match.

func Any

func Any(conditions ...Condition) Condition

Any requires at least one child condition to match.

func Equal added in v0.2.0

func Equal[Value ConditionScalar](reference Reference, value Value) Condition

Equal compares a referenced scalar field with one finite value.

func Not

func Not(condition Condition) Condition

Not negates one child condition.

func NotEqual added in v0.2.0

func NotEqual[Value ConditionScalar](reference Reference, value Value) Condition

NotEqual compares a referenced scalar field with one finite value.

func OneOf

func OneOf[Value ConditionScalar](reference Reference, values ...Value) Condition

OneOf matches any configured finite value of one scalar type.

func (Condition) Conditions

func (condition Condition) Conditions() []Condition

Conditions returns detached child expressions for All, Any, and Not nodes.

func (Condition) Err added in v0.2.0

func (condition Condition) Err() error

Err checks a condition's finite declaration without resolving its references.

func (Condition) IsZero added in v0.2.0

func (condition Condition) IsZero() bool

IsZero reports that no visibility condition was supplied.

func (Condition) Kind

func (condition Condition) Kind() ConditionKind

Kind reports whether this node is a logical group, negation, or predicate.

func (Condition) MarshalJSON added in v0.2.0

func (condition Condition) MarshalJSON() ([]byte, error)

MarshalJSON serializes the finite authoring tree without resolving references.

func (Condition) Operator

func (condition Condition) Operator() ConditionOperator

Operator returns the predicate's scalar comparison operator.

func (Condition) Reference added in v0.2.0

func (condition Condition) Reference() Reference

Reference returns the predicate's authored field selector.

func (Condition) Values

func (condition Condition) Values() []DefaultValue

Values returns detached, canonically encoded predicate operands.

type ConditionKind

type ConditionKind string

ConditionKind identifies one node in a presentation-only condition tree.

const (
	ConditionKindAll       ConditionKind = "all"
	ConditionKindAny       ConditionKind = "any"
	ConditionKindNot       ConditionKind = "not"
	ConditionKindPredicate ConditionKind = "predicate"
)

type ConditionOperator

type ConditionOperator string

ConditionOperator identifies one scalar predicate operation.

const (
	ConditionEquals    ConditionOperator = "equals"
	ConditionNotEquals ConditionOperator = "notEquals"
	ConditionOneOf     ConditionOperator = "oneOf"
)

type ConditionScalar

type ConditionScalar interface {
	~string | ~bool | ~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64
}

ConditionScalar is the finite scalar vocabulary accepted by condition predicates.

type DateField added in v0.2.0

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

DateField configures a field for a date, time, or timestamp.

func AsDate added in v0.2.0

func AsDate(node Node) (DateField, error)

AsDate provides a checked concrete view of an immutable node.

func Date

func Date(name string) DateField

Date creates a field for a date, time, or timestamp.

func (DateField) Access added in v0.2.0

func (f DateField) Access(value Access) DateField

Access replaces the complete field access policy.

func (DateField) AccessPolicy added in v0.2.0

func (v DateField) AccessPolicy() Access

func (DateField) Admin added in v0.2.0

func (f DateField) Admin(value Admin) DateField

Admin replaces the complete admin presentation policy.

func (DateField) AdminPolicy added in v0.2.0

func (v DateField) AdminPolicy() Admin

func (DateField) AfterRead added in v0.2.2

func (f DateField) AfterRead(callbacks ...OutputTransform[string]) DateField

AfterRead appends response transforms in order; no callbacks does nothing.

func (DateField) AfterReadHooks added in v0.2.2

func (f DateField) AfterReadHooks() []OutputTransform[string]

AfterReadHooks returns a detached response-transform slice.

func (DateField) AppendHooks added in v0.2.0

func (f DateField) AppendHooks(value Hooks[string]) DateField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (DateField) BehaviorSummary added in v0.2.0

func (v DateField) BehaviorSummary() PolicySummary

func (DateField) Children added in v0.2.0

func (v DateField) Children() Fields

func (DateField) Default added in v0.2.0

func (f DateField) Default(value string) DateField

func (DateField) DefaultCallback added in v0.2.0

func (f DateField) DefaultCallback() DefaultFunc[string]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (DateField) DefaultFrom added in v0.2.0

func (f DateField) DefaultFrom(callback DefaultFunc[string]) DateField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (DateField) EditAdmin added in v0.2.0

func (f DateField) EditAdmin(edit func(*Admin)) DateField

EditAdmin updates selected admin settings while preserving the rest.

func (DateField) Format added in v0.2.0

func (f DateField) Format(value DateFormat) DateField

Format selects whether the field accepts a date, timestamp, or local time. DateOnly is the default. Admin display settings do not change the stored format.

func (DateField) HookPolicy added in v0.2.0

func (f DateField) HookPolicy() Hooks[string]

func (DateField) Hooks added in v0.2.0

func (f DateField) Hooks(value Hooks[string]) DateField

Hooks replaces the complete field lifecycle hook group.

func (DateField) Index added in v0.2.0

func (f DateField) Index(values ...bool) DateField

func (DateField) IsLocalized added in v0.2.0

func (v DateField) IsLocalized() bool

func (DateField) IsRequired added in v0.2.0

func (v DateField) IsRequired() bool

func (DateField) Kind added in v0.2.0

func (v DateField) Kind() Kind

func (DateField) Label added in v0.2.0

func (f DateField) Label(value string) DateField

func (DateField) LabelText added in v0.2.0

func (v DateField) LabelText() string

func (DateField) LabelTranslations added in v0.2.0

func (f DateField) LabelTranslations(values map[string]string) DateField

func (DateField) LiveValidate added in v0.2.0

func (f DateField) LiveValidate(value LiveValidator[string]) DateField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (DateField) LiveValidators added in v0.2.0

func (f DateField) LiveValidators() []LiveValidator[string]

LiveValidators returns a detached list of this field's advisory server checks.

func (DateField) Localized added in v0.2.0

func (f DateField) Localized(values ...bool) DateField

func (DateField) Name added in v0.2.0

func (v DateField) Name() string

func (DateField) PrependHooks added in v0.2.0

func (f DateField) PrependHooks(value Hooks[string]) DateField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (DateField) Private added in v0.2.0

func (f DateField) Private(namespace string, value store.Value) DateField

func (DateField) Provenance added in v0.2.0

func (v DateField) Provenance() []string

func (DateField) Rename added in v0.2.0

func (f DateField) Rename(name string) DateField

func (DateField) ReplaceAfterRead added in v0.2.2

func (f DateField) ReplaceAfterRead(callbacks ...OutputTransform[string]) DateField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (DateField) ReplaceLiveValidators added in v0.2.0

func (f DateField) ReplaceLiveValidators(values ...LiveValidator[string]) DateField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (DateField) ReplaceValidators added in v0.2.0

func (f DateField) ReplaceValidators(values ...Validator[string]) DateField

ReplaceValidators replaces all authoritative save validators.

func (DateField) Required added in v0.2.0

func (f DateField) Required(values ...bool) DateField

func (DateField) RestrictAccess added in v0.2.0

func (f DateField) RestrictAccess(value Access) DateField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (DateField) Unique added in v0.2.0

func (f DateField) Unique(values ...bool) DateField

func (DateField) Validate added in v0.2.0

func (f DateField) Validate(value Validator[string]) DateField

Validate appends one authoritative save validator.

func (DateField) Validators added in v0.2.0

func (f DateField) Validators() []Validator[string]

type DateFormat added in v0.2.0

type DateFormat string

DateFormat selects a date field's accepted value contract. The admin control follows this format; changing presentation never changes accepted API values.

const (
	DateOnly DateFormat = "date"
	DateTime DateFormat = "date-time"
	TimeOnly DateFormat = "time"
)

type DefaultFunc added in v0.2.0

type DefaultFunc[T any] func(operation.Context) (operation.Value[T], error)

DefaultFunc supplies a server-side initial value for an eligible omitted field. Root and Siblings are snapshots at initialization; Prior is the persisted enclosing object or stable row (empty for new rows). ID may be empty. Locale is exact and Local retains authorization, cancellation and the active transaction. Present supplies a value, including zero values; Empty leaves it without a default. An error stops the operation. Returned values still pass validation. Defaults do not prefill an unsaved admin form and do not run on ordinary edits to an existing scope. Callbacks must not depend on other dynamic defaults or perform irreversible side effects: separate requests or retries can run again.

type DefaultKind

type DefaultKind string

DefaultKind identifies the logical value carried by a field default.

const (
	DefaultList    DefaultKind = "list"
	DefaultString  DefaultKind = "string"
	DefaultNumber  DefaultKind = "number"
	DefaultBoolean DefaultKind = "boolean"
)

type DefaultValue

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

DefaultValue is the normalized literal value produced by Default.

func (DefaultValue) Kind

func (value DefaultValue) Kind() DefaultKind

Kind reports whether the normalized default is a string, number, boolean, or primitive list.

func (DefaultValue) String

func (value DefaultValue) String() string

String returns the canonical textual encoding written to the manifest.

type EditError added in v0.2.0

type EditError struct {
	Code string
	Name string
	// Expected and Actual name the concrete field shapes for incompatible edits.
	Expected string
	Actual   string
}

EditError identifies a failed explicit authoring edit. Failed transactions return the original graph and publish no partial changes.

func (*EditError) Error added in v0.2.0

func (e *EditError) Error() string

type EmailField added in v0.2.0

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

EmailField configures a field that stores and validates an email address.

func AsEmail added in v0.2.0

func AsEmail(node Node) (EmailField, error)

AsEmail provides a checked concrete view of an immutable node.

func Email

func Email(name string) EmailField

Email creates a field that stores and validates an email address.

func (EmailField) Access added in v0.2.0

func (f EmailField) Access(value Access) EmailField

Access replaces the complete field access policy.

func (EmailField) AccessPolicy added in v0.2.0

func (v EmailField) AccessPolicy() Access

func (EmailField) Admin added in v0.2.0

func (f EmailField) Admin(value Admin) EmailField

Admin replaces the complete admin presentation policy.

func (EmailField) AdminPolicy added in v0.2.0

func (v EmailField) AdminPolicy() Admin

func (EmailField) AfterRead added in v0.2.2

func (f EmailField) AfterRead(callbacks ...OutputTransform[string]) EmailField

AfterRead appends response transforms in order; no callbacks does nothing.

func (EmailField) AfterReadHooks added in v0.2.2

func (f EmailField) AfterReadHooks() []OutputTransform[string]

AfterReadHooks returns a detached response-transform slice.

func (EmailField) AppendHooks added in v0.2.0

func (f EmailField) AppendHooks(value Hooks[string]) EmailField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (EmailField) BehaviorSummary added in v0.2.0

func (v EmailField) BehaviorSummary() PolicySummary

func (EmailField) Children added in v0.2.0

func (v EmailField) Children() Fields

func (EmailField) Default added in v0.2.0

func (f EmailField) Default(value string) EmailField

func (EmailField) DefaultCallback added in v0.2.0

func (f EmailField) DefaultCallback() DefaultFunc[string]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (EmailField) DefaultFrom added in v0.2.0

func (f EmailField) DefaultFrom(callback DefaultFunc[string]) EmailField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (EmailField) EditAdmin added in v0.2.0

func (f EmailField) EditAdmin(edit func(*Admin)) EmailField

EditAdmin updates selected admin settings while preserving the rest.

func (EmailField) HookPolicy added in v0.2.0

func (f EmailField) HookPolicy() Hooks[string]

func (EmailField) Hooks added in v0.2.0

func (f EmailField) Hooks(value Hooks[string]) EmailField

Hooks replaces the complete field lifecycle hook group.

func (EmailField) Index added in v0.2.0

func (f EmailField) Index(values ...bool) EmailField

func (EmailField) IsLocalized added in v0.2.0

func (v EmailField) IsLocalized() bool

func (EmailField) IsRequired added in v0.2.0

func (v EmailField) IsRequired() bool

func (EmailField) Kind added in v0.2.0

func (v EmailField) Kind() Kind

func (EmailField) Label added in v0.2.0

func (f EmailField) Label(value string) EmailField

func (EmailField) LabelText added in v0.2.0

func (v EmailField) LabelText() string

func (EmailField) LabelTranslations added in v0.2.0

func (f EmailField) LabelTranslations(values map[string]string) EmailField

func (EmailField) LiveValidate added in v0.2.0

func (f EmailField) LiveValidate(value LiveValidator[string]) EmailField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (EmailField) LiveValidators added in v0.2.0

func (f EmailField) LiveValidators() []LiveValidator[string]

LiveValidators returns a detached list of this field's advisory server checks.

func (EmailField) Localized added in v0.2.0

func (f EmailField) Localized(values ...bool) EmailField

func (EmailField) Name added in v0.2.0

func (v EmailField) Name() string

func (EmailField) PrependHooks added in v0.2.0

func (f EmailField) PrependHooks(value Hooks[string]) EmailField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (EmailField) Private added in v0.2.0

func (f EmailField) Private(namespace string, value store.Value) EmailField

func (EmailField) Provenance added in v0.2.0

func (v EmailField) Provenance() []string

func (EmailField) Rename added in v0.2.0

func (f EmailField) Rename(name string) EmailField

func (EmailField) ReplaceAfterRead added in v0.2.2

func (f EmailField) ReplaceAfterRead(callbacks ...OutputTransform[string]) EmailField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (EmailField) ReplaceLiveValidators added in v0.2.0

func (f EmailField) ReplaceLiveValidators(values ...LiveValidator[string]) EmailField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (EmailField) ReplaceValidators added in v0.2.0

func (f EmailField) ReplaceValidators(values ...Validator[string]) EmailField

ReplaceValidators replaces all authoritative save validators.

func (EmailField) Required added in v0.2.0

func (f EmailField) Required(values ...bool) EmailField

func (EmailField) RestrictAccess added in v0.2.0

func (f EmailField) RestrictAccess(value Access) EmailField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (EmailField) Unique added in v0.2.0

func (f EmailField) Unique(values ...bool) EmailField

func (EmailField) Validate added in v0.2.0

func (f EmailField) Validate(value Validator[string]) EmailField

Validate appends one authoritative save validator.

func (EmailField) Validators added in v0.2.0

func (f EmailField) Validators() []Validator[string]

type EmbeddedTree added in v0.2.0

type EmbeddedTree struct {
	Key      string
	Root     []string
	Children string
	Tag      string
	Cases    []EmbeddedTreeCase
}

EmbeddedTree describes a finite tree inside a plugin value. Root is a literal property path to a node (or a list of nodes). Children is a structural child list property. Payload objects are handed back to ordinary field processing; they are never searched for more nodes by this descriptor.

type EmbeddedTreeCase added in v0.2.0

type EmbeddedTreeCase struct {
	TagValue        string
	Payload         string
	Discriminator   string
	Identity        string
	Types           []Block
	BlockReferences []string
	// contains filtered or unexported fields
}

EmbeddedTreeCase declares schema-owned payloads for one structural node tag. Discriminator and Identity name properties inside Payload. Types reuse the ordinary field vocabulary; plugin settings must not serialize these definitions.

type Fields

type Fields []Node

Fields is the ordered list assigned to ridu.Collection.Fields, ridu.Global.Fields, or a nested field constructor. Populate it with Nodes from this package's constructors. Ridu snapshots the caller-owned slice during construction, editing, and config resolution.

For example:

fields := field.Fields{
	field.Text("title").Required(),
	field.Select("status", "draft", "published"),
	field.Group("seo", field.Fields{
		field.Textarea("description"),
	}),
}

func (Fields) Edit added in v0.2.0

func (fields Fields) Edit(edit func(*ChildrenDraft) error) (Fields, error)

Edit applies checked changes to a detached draft and returns a new field list. Use it to refine a reusable graph without rebuilding it. The result is published only when the callback and graph validation succeed; on error, Edit returns an unchanged snapshot of the original fields.

func (Fields) Snapshot added in v0.2.0

func (f Fields) Snapshot() Fields

Snapshot detaches the mutable slice and freezes pointer facade inputs.

func (Fields) Walk added in v0.2.0

func (fields Fields) Walk(visit func(Visit) error) error

Walk visits nodes in declaration order and crosses only explicit branches.

func (Fields) WithProvenance added in v0.2.0

func (f Fields) WithProvenance(source string) Fields

WithProvenance marks every published node as passing through a transform.

type GroupField added in v0.2.0

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

GroupField configures a nested object containing the supplied fields.

func AsGroup added in v0.2.0

func AsGroup(node Node) (GroupField, error)

AsGroup provides a checked concrete view of an immutable node.

func Group

func Group(name string, children Fields) GroupField

Group creates a nested object containing the supplied fields.

func NamedTab

func NamedTab(name, label string, children Fields) GroupField

NamedTab groups fields in an admin tab and stores them in a named object.

func (GroupField) Access added in v0.2.0

func (f GroupField) Access(value Access) GroupField

Access replaces the complete field access policy.

func (GroupField) AccessPolicy added in v0.2.0

func (v GroupField) AccessPolicy() Access

func (GroupField) Admin added in v0.2.0

func (f GroupField) Admin(value Admin) GroupField

Admin replaces the complete admin presentation policy.

func (GroupField) AdminPolicy added in v0.2.0

func (v GroupField) AdminPolicy() Admin

func (GroupField) AfterRead added in v0.2.2

func (f GroupField) AfterRead(callbacks ...OutputTransform[store.Value]) GroupField

AfterRead appends response transforms in order; no callbacks does nothing.

func (GroupField) AfterReadHooks added in v0.2.2

func (f GroupField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (GroupField) AppendHooks added in v0.2.0

func (f GroupField) AppendHooks(value Hooks[store.Value]) GroupField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (GroupField) BehaviorSummary added in v0.2.0

func (v GroupField) BehaviorSummary() PolicySummary

func (GroupField) Children added in v0.2.0

func (v GroupField) Children() Fields

func (GroupField) EditAdmin added in v0.2.0

func (f GroupField) EditAdmin(edit func(*Admin)) GroupField

EditAdmin updates selected admin settings while preserving the rest.

func (GroupField) EditChildren added in v0.2.0

func (f GroupField) EditChildren(edit func(*ChildrenDraft) error) (GroupField, error)

func (GroupField) HookPolicy added in v0.2.0

func (f GroupField) HookPolicy() Hooks[store.Value]

func (GroupField) Hooks added in v0.2.0

func (f GroupField) Hooks(value Hooks[store.Value]) GroupField

Hooks replaces the complete field lifecycle hook group.

func (GroupField) IsLocalized added in v0.2.0

func (v GroupField) IsLocalized() bool

func (GroupField) IsRequired added in v0.2.0

func (v GroupField) IsRequired() bool

func (GroupField) Kind added in v0.2.0

func (v GroupField) Kind() Kind

func (GroupField) Label added in v0.2.0

func (f GroupField) Label(value string) GroupField

func (GroupField) LabelText added in v0.2.0

func (v GroupField) LabelText() string

func (GroupField) LabelTranslations added in v0.2.0

func (f GroupField) LabelTranslations(values map[string]string) GroupField

func (GroupField) LiveValidate added in v0.2.0

func (f GroupField) LiveValidate(value LiveValidator[store.Value]) GroupField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (GroupField) LiveValidators added in v0.2.0

func (f GroupField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (GroupField) Localized added in v0.2.0

func (f GroupField) Localized(values ...bool) GroupField

func (GroupField) Name added in v0.2.0

func (v GroupField) Name() string

func (GroupField) PrependHooks added in v0.2.0

func (f GroupField) PrependHooks(value Hooks[store.Value]) GroupField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (GroupField) Private added in v0.2.0

func (f GroupField) Private(namespace string, value store.Value) GroupField

func (GroupField) Provenance added in v0.2.0

func (v GroupField) Provenance() []string

func (GroupField) Rename added in v0.2.0

func (f GroupField) Rename(name string) GroupField

func (GroupField) ReplaceAfterRead added in v0.2.2

func (f GroupField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) GroupField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (GroupField) ReplaceLiveValidators added in v0.2.0

func (f GroupField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) GroupField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (GroupField) ReplaceValidators added in v0.2.0

func (f GroupField) ReplaceValidators(values ...Validator[store.Value]) GroupField

ReplaceValidators replaces all authoritative save validators.

func (GroupField) Required added in v0.2.0

func (f GroupField) Required(values ...bool) GroupField

func (GroupField) RestrictAccess added in v0.2.0

func (f GroupField) RestrictAccess(value Access) GroupField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (GroupField) Validate added in v0.2.0

func (f GroupField) Validate(value Validator[store.Value]) GroupField

Validate appends one authoritative save validator.

func (GroupField) Validators added in v0.2.0

func (f GroupField) Validators() []Validator[store.Value]

type Hooks added in v0.2.0

type Hooks[T any] struct {
	// BeforeDuplicate receives raw copied input before validation. It runs only
	// when duplicating a collection document, after the resource hook.
	BeforeDuplicate []RawTransform
	// BeforeValidate receives raw input before built-in validation. It can supply
	// or normalize a value before conversion to T. This shared phase also runs on
	// reads and deletes; check the context's Operation for write-only logic.
	BeforeValidate []RawTransform
	// BeforeChange transforms T after initial built-in checks on create,
	// duplicate, update, publish, and unpublish. Custom validators run later.
	BeforeChange []Transform[T]
	// BeforeOperation transforms T before the store operation, after BeforeChange
	// on writes. This shared phase also runs on reads and deletes.
	BeforeOperation []Transform[T]
	// BeforeDelete observes the saved value before trashing or permanent deletion.
	BeforeDelete []Observer[T]
	// AfterChange observes a saved create, duplicate, update, publish, or unpublish
	// before commit. It cannot replace the field; an error rolls back the save.
	AfterChange []Observer[T]
	// AfterDelete observes a value after trashing or permanent deletion but before
	// commit. An error can still roll back the deletion.
	AfterDelete []Observer[T]
	// AfterOperation observes the result before response processing and commit.
	// It also runs on reads and deletes; check Operation for write-only work.
	AfterOperation []Observer[T]
	// AfterCommit observes the value outside the committed transaction, before
	// resource AfterCommit hooks. It also runs for reads. Errors cannot roll back
	// saved data, and later effects still run.
	AfterCommit []Observer[T]
}

Hooks registers transforms and event callbacks for one field. Each list runs in declaration order for each field occurrence, including nested array rows. Collection or global hooks run first in the same phase, except AfterCommit, where field callbacks run first. Use AfterRead for response transformations.

type Issue

type Issue struct {
	// Code is a stable machine-readable problem identifier.
	Code string
	// Path locates the invalid property within the field definition.
	Path string
	// Message explains how to correct the problem.
	Message string
}

Issue records a definition problem relative to the field. Config resolution prefixes Path with the field's exact location in the application config.

type JSONField added in v0.2.0

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

JSONField configures a field for JSON data.

func AsJSON added in v0.2.0

func AsJSON(node Node) (JSONField, error)

AsJSON provides a checked concrete view of an immutable node.

func JSON

func JSON(name string) JSONField

JSON creates a field for JSON data.

func (JSONField) Access added in v0.2.0

func (f JSONField) Access(value Access) JSONField

Access replaces the complete field access policy.

func (JSONField) AccessPolicy added in v0.2.0

func (v JSONField) AccessPolicy() Access

func (JSONField) Admin added in v0.2.0

func (f JSONField) Admin(value Admin) JSONField

Admin replaces the complete admin presentation policy.

func (JSONField) AdminPolicy added in v0.2.0

func (v JSONField) AdminPolicy() Admin

func (JSONField) AfterRead added in v0.2.2

func (f JSONField) AfterRead(callbacks ...OutputTransform[store.Value]) JSONField

AfterRead appends response transforms in order; no callbacks does nothing.

func (JSONField) AfterReadHooks added in v0.2.2

func (f JSONField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (JSONField) AppendHooks added in v0.2.0

func (f JSONField) AppendHooks(value Hooks[store.Value]) JSONField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (JSONField) BehaviorSummary added in v0.2.0

func (v JSONField) BehaviorSummary() PolicySummary

func (JSONField) Children added in v0.2.0

func (v JSONField) Children() Fields

func (JSONField) EditAdmin added in v0.2.0

func (f JSONField) EditAdmin(edit func(*Admin)) JSONField

EditAdmin updates selected admin settings while preserving the rest.

func (JSONField) HookPolicy added in v0.2.0

func (f JSONField) HookPolicy() Hooks[store.Value]

func (JSONField) Hooks added in v0.2.0

func (f JSONField) Hooks(value Hooks[store.Value]) JSONField

Hooks replaces the complete field lifecycle hook group.

func (JSONField) IsLocalized added in v0.2.0

func (v JSONField) IsLocalized() bool

func (JSONField) IsRequired added in v0.2.0

func (v JSONField) IsRequired() bool

func (JSONField) Kind added in v0.2.0

func (v JSONField) Kind() Kind

func (JSONField) Label added in v0.2.0

func (f JSONField) Label(value string) JSONField

func (JSONField) LabelText added in v0.2.0

func (v JSONField) LabelText() string

func (JSONField) LabelTranslations added in v0.2.0

func (f JSONField) LabelTranslations(values map[string]string) JSONField

func (JSONField) LiveValidate added in v0.2.0

func (f JSONField) LiveValidate(value LiveValidator[store.Value]) JSONField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (JSONField) LiveValidators added in v0.2.0

func (f JSONField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (JSONField) Localized added in v0.2.0

func (f JSONField) Localized(values ...bool) JSONField

func (JSONField) Name added in v0.2.0

func (v JSONField) Name() string

func (JSONField) PrependHooks added in v0.2.0

func (f JSONField) PrependHooks(value Hooks[store.Value]) JSONField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (JSONField) Private added in v0.2.0

func (f JSONField) Private(namespace string, value store.Value) JSONField

func (JSONField) Provenance added in v0.2.0

func (v JSONField) Provenance() []string

func (JSONField) Rename added in v0.2.0

func (f JSONField) Rename(name string) JSONField

func (JSONField) ReplaceAfterRead added in v0.2.2

func (f JSONField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) JSONField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (JSONField) ReplaceLiveValidators added in v0.2.0

func (f JSONField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) JSONField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (JSONField) ReplaceValidators added in v0.2.0

func (f JSONField) ReplaceValidators(values ...Validator[store.Value]) JSONField

ReplaceValidators replaces all authoritative save validators.

func (JSONField) Required added in v0.2.0

func (f JSONField) Required(values ...bool) JSONField

func (JSONField) RestrictAccess added in v0.2.0

func (f JSONField) RestrictAccess(value Access) JSONField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (JSONField) Validate added in v0.2.0

func (f JSONField) Validate(value Validator[store.Value]) JSONField

Validate appends one authoritative save validator.

func (JSONField) Validators added in v0.2.0

func (f JSONField) Validators() []Validator[store.Value]

type JoinField added in v0.2.0

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

JoinField configures a list of documents that refer back to this document.

func AsJoin added in v0.2.0

func AsJoin(node Node) (JoinField, error)

AsJoin provides a checked inverse join output facade.

func Join

func Join(name, collection, on string) JoinField

Join creates a list of documents that refer back to this document.

func (JoinField) Access added in v0.2.0

func (f JoinField) Access(value Access) JoinField

Access replaces the read authorization group on an inverse output join.

func (JoinField) AccessPolicy added in v0.2.0

func (v JoinField) AccessPolicy() Access

func (JoinField) Admin added in v0.2.0

func (f JoinField) Admin(value Admin) JoinField

Admin replaces the complete admin presentation policy.

func (JoinField) AdminPolicy added in v0.2.0

func (v JoinField) AdminPolicy() Admin

func (JoinField) AfterRead added in v0.2.2

func (f JoinField) AfterRead(callbacks ...OutputTransform[store.Value]) JoinField

AfterRead appends response transforms in order; no callbacks does nothing.

func (JoinField) AfterReadHooks added in v0.2.2

func (f JoinField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice. AfterReadHooks returns a detached response-transform slice.

func (JoinField) AllowCreate added in v0.2.0

func (f JoinField) AllowCreate(value bool) JoinField

func (JoinField) BehaviorSummary added in v0.2.0

func (v JoinField) BehaviorSummary() PolicySummary

func (JoinField) Children added in v0.2.0

func (v JoinField) Children() Fields

func (JoinField) DefaultColumns added in v0.2.0

func (f JoinField) DefaultColumns(paths ...string) JoinField

func (JoinField) DefaultSort added in v0.2.0

func (f JoinField) DefaultSort(value string) JoinField

func (JoinField) EditAdmin added in v0.2.0

func (f JoinField) EditAdmin(edit func(*Admin)) JoinField

EditAdmin updates selected admin settings while preserving the rest.

func (JoinField) IsLocalized added in v0.2.0

func (v JoinField) IsLocalized() bool

func (JoinField) IsRequired added in v0.2.0

func (v JoinField) IsRequired() bool

func (JoinField) Kind added in v0.2.0

func (v JoinField) Kind() Kind

func (JoinField) Label added in v0.2.0

func (f JoinField) Label(value string) JoinField

func (JoinField) LabelText added in v0.2.0

func (v JoinField) LabelText() string

func (JoinField) LabelTranslations added in v0.2.0

func (f JoinField) LabelTranslations(values map[string]string) JoinField

func (JoinField) Limit added in v0.2.0

func (f JoinField) Limit(value int) JoinField

func (JoinField) Name added in v0.2.0

func (v JoinField) Name() string

func (JoinField) Private added in v0.2.0

func (f JoinField) Private(namespace string, value store.Value) JoinField

func (JoinField) Provenance added in v0.2.0

func (v JoinField) Provenance() []string

func (JoinField) Rename added in v0.2.0

func (f JoinField) Rename(name string) JoinField

func (JoinField) ReplaceAfterRead added in v0.2.2

func (f JoinField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) JoinField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (JoinField) RestrictAccess added in v0.2.0

func (f JoinField) RestrictAccess(value Access) JoinField

RestrictAccess conjoins the supplied join output access policy.

type Kind

type Kind string

Kind identifies a built-in authoring field definition.

const (
	KindText         Kind = "text"
	KindTextList     Kind = "text-list"
	KindNumberList   Kind = "number-list"
	KindCode         Kind = "code"
	KindSelect       Kind = "select"
	KindRadio        Kind = "radio"
	KindPoint        Kind = "point"
	KindRelationship Kind = "relationship"
	KindUpload       Kind = "upload"
	KindGroup        Kind = "group"
	KindTextarea     Kind = "textarea"
	KindEmail        Kind = "email"
	KindDate         Kind = "date"
	KindNumber       Kind = "number"
	KindCheckbox     Kind = "checkbox"
	KindJSON         Kind = "json"
	KindArray        Kind = "array"
	KindBlocks       Kind = "blocks"
	KindTabs         Kind = "tabs"
	KindRow          Kind = "row"
	KindUI           Kind = "ui"
	KindCollapsible  Kind = "collapsible"
	KindJoin         Kind = "join"
	KindVirtual      Kind = "virtual"
	KindPlugin       Kind = "plugin"
)

type LayoutField added in v0.2.0

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

LayoutField arranges fields in the admin without adding a stored value.

func Collapsible

func Collapsible(name string, children Fields) LayoutField

Collapsible displays fields beneath a heading the author can expand or collapse.

func Row

func Row(children Fields) LayoutField

Row displays fields side by side without nesting their stored values.

func Tabs

func Tabs(children Fields) LayoutField

Tabs displays named and unnamed tabs together in the admin.

func UI

func UI(name string) LayoutField

UI adds a custom component to the form without storing a value.

func UnnamedTab

func UnnamedTab(label string, children Fields) LayoutField

UnnamedTab groups fields in an admin tab without nesting their stored values.

func (LayoutField) AccessPolicy added in v0.2.0

func (v LayoutField) AccessPolicy() Access

func (LayoutField) Admin added in v0.2.0

func (f LayoutField) Admin(value Admin) LayoutField

Admin replaces the complete admin presentation policy.

func (LayoutField) AdminPolicy added in v0.2.0

func (v LayoutField) AdminPolicy() Admin

func (LayoutField) BehaviorSummary added in v0.2.0

func (v LayoutField) BehaviorSummary() PolicySummary

func (LayoutField) Children added in v0.2.0

func (v LayoutField) Children() Fields

func (LayoutField) EditAdmin added in v0.2.0

func (f LayoutField) EditAdmin(edit func(*Admin)) LayoutField

EditAdmin updates selected admin settings while preserving the rest.

func (LayoutField) IsLocalized added in v0.2.0

func (v LayoutField) IsLocalized() bool

func (LayoutField) IsRequired added in v0.2.0

func (v LayoutField) IsRequired() bool

func (LayoutField) Kind added in v0.2.0

func (v LayoutField) Kind() Kind

func (LayoutField) Label added in v0.2.0

func (f LayoutField) Label(value string) LayoutField

func (LayoutField) LabelText added in v0.2.0

func (v LayoutField) LabelText() string

func (LayoutField) LabelTranslations added in v0.2.0

func (f LayoutField) LabelTranslations(values map[string]string) LayoutField

func (LayoutField) Name added in v0.2.0

func (v LayoutField) Name() string

func (LayoutField) Private added in v0.2.0

func (f LayoutField) Private(namespace string, value store.Value) LayoutField

func (LayoutField) Provenance added in v0.2.0

func (v LayoutField) Provenance() []string

func (LayoutField) Rename added in v0.2.0

func (f LayoutField) Rename(name string) LayoutField

type LiveValidator added in v0.2.0

type LiveValidator[T any] func(operation.LiveValidationContext, operation.Value[T]) ([]operation.Issue, error)

LiveValidator checks a typed unsaved value on explicit admin feedback requests. Root and Siblings contain retained input, without save hooks or defaults. Reuse business rules with Validator through thin, separately typed adapters. A live check never replaces authoritative save validation.

Return operation.Issue values for user-correctable problems, or an error when the check could not run. Checks must be repeatable, read-only and respect the context's cancellation. The framework cannot prevent side effects in arbitrary application Go code. Invalid typed input is skipped before this callback runs. Aggregate store.Value callbacks receive raw object/list carriers: their children may still be incomplete or malformed. No deep save validation has run.

type MultiSelectField added in v0.2.0

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

MultiSelectField configures a field for choosing several values from a fixed list.

func AsMultiSelect added in v0.2.0

func AsMultiSelect(node Node) (MultiSelectField, error)

AsMultiSelect provides a checked concrete view of an immutable node.

func MultiSelect added in v0.2.0

func MultiSelect(name string, values ...string) MultiSelectField

MultiSelect creates a field for choosing several values from a fixed list. Values are stored exactly as given; display labels are generated during resolution. Use Options to configure custom labels or translations.

func (MultiSelectField) Access added in v0.2.0

func (f MultiSelectField) Access(value Access) MultiSelectField

Access replaces the complete field access policy.

func (MultiSelectField) AccessPolicy added in v0.2.0

func (v MultiSelectField) AccessPolicy() Access

func (MultiSelectField) Admin added in v0.2.0

func (f MultiSelectField) Admin(value Admin) MultiSelectField

Admin replaces the complete admin presentation policy.

func (MultiSelectField) AdminPolicy added in v0.2.0

func (v MultiSelectField) AdminPolicy() Admin

func (MultiSelectField) AfterRead added in v0.2.2

func (f MultiSelectField) AfterRead(callbacks ...OutputTransform[[]string]) MultiSelectField

AfterRead appends response transforms in order; no callbacks does nothing.

func (MultiSelectField) AfterReadHooks added in v0.2.2

func (f MultiSelectField) AfterReadHooks() []OutputTransform[[]string]

AfterReadHooks returns a detached response-transform slice.

func (MultiSelectField) AppendHooks added in v0.2.0

func (f MultiSelectField) AppendHooks(value Hooks[[]string]) MultiSelectField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (MultiSelectField) BehaviorSummary added in v0.2.0

func (v MultiSelectField) BehaviorSummary() PolicySummary

func (MultiSelectField) Children added in v0.2.0

func (v MultiSelectField) Children() Fields

func (MultiSelectField) Default added in v0.2.0

func (f MultiSelectField) Default(values ...string) MultiSelectField

func (MultiSelectField) DefaultCallback added in v0.2.0

func (f MultiSelectField) DefaultCallback() DefaultFunc[[]string]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (MultiSelectField) DefaultFrom added in v0.2.0

func (f MultiSelectField) DefaultFrom(callback DefaultFunc[[]string]) MultiSelectField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (MultiSelectField) EditAdmin added in v0.2.0

func (f MultiSelectField) EditAdmin(edit func(*Admin)) MultiSelectField

EditAdmin updates selected admin settings while preserving the rest.

func (MultiSelectField) HookPolicy added in v0.2.0

func (f MultiSelectField) HookPolicy() Hooks[[]string]

func (MultiSelectField) Hooks added in v0.2.0

func (f MultiSelectField) Hooks(value Hooks[[]string]) MultiSelectField

Hooks replaces the complete field lifecycle hook group.

func (MultiSelectField) IsLocalized added in v0.2.0

func (v MultiSelectField) IsLocalized() bool

func (MultiSelectField) IsRequired added in v0.2.0

func (v MultiSelectField) IsRequired() bool

func (MultiSelectField) Kind added in v0.2.0

func (v MultiSelectField) Kind() Kind

func (MultiSelectField) Label added in v0.2.0

func (f MultiSelectField) Label(value string) MultiSelectField

func (MultiSelectField) LabelText added in v0.2.0

func (v MultiSelectField) LabelText() string

func (MultiSelectField) LabelTranslations added in v0.2.0

func (f MultiSelectField) LabelTranslations(values map[string]string) MultiSelectField

func (MultiSelectField) LiveValidate added in v0.2.0

func (f MultiSelectField) LiveValidate(value LiveValidator[[]string]) MultiSelectField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (MultiSelectField) LiveValidators added in v0.2.0

func (f MultiSelectField) LiveValidators() []LiveValidator[[]string]

LiveValidators returns a detached list of this field's advisory server checks.

func (MultiSelectField) Localized added in v0.2.0

func (f MultiSelectField) Localized(values ...bool) MultiSelectField

func (MultiSelectField) Name added in v0.2.0

func (v MultiSelectField) Name() string

func (MultiSelectField) Options added in v0.2.0

func (f MultiSelectField) Options(values ...Option) MultiSelectField

Options replaces the option list with options that can include labels and translations.

func (MultiSelectField) PrependHooks added in v0.2.0

func (f MultiSelectField) PrependHooks(value Hooks[[]string]) MultiSelectField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (MultiSelectField) Private added in v0.2.0

func (f MultiSelectField) Private(namespace string, value store.Value) MultiSelectField

func (MultiSelectField) Provenance added in v0.2.0

func (v MultiSelectField) Provenance() []string

func (MultiSelectField) Rename added in v0.2.0

func (f MultiSelectField) Rename(name string) MultiSelectField

func (MultiSelectField) ReplaceAfterRead added in v0.2.2

func (f MultiSelectField) ReplaceAfterRead(callbacks ...OutputTransform[[]string]) MultiSelectField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (MultiSelectField) ReplaceLiveValidators added in v0.2.0

func (f MultiSelectField) ReplaceLiveValidators(values ...LiveValidator[[]string]) MultiSelectField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (MultiSelectField) ReplaceValidators added in v0.2.0

func (f MultiSelectField) ReplaceValidators(values ...Validator[[]string]) MultiSelectField

ReplaceValidators replaces all authoritative save validators.

func (MultiSelectField) Required added in v0.2.0

func (f MultiSelectField) Required(values ...bool) MultiSelectField

func (MultiSelectField) RestrictAccess added in v0.2.0

func (f MultiSelectField) RestrictAccess(value Access) MultiSelectField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (MultiSelectField) Validate added in v0.2.0

func (f MultiSelectField) Validate(value Validator[[]string]) MultiSelectField

Validate appends one authoritative save validator.

func (MultiSelectField) Validators added in v0.2.0

func (f MultiSelectField) Validators() []Validator[[]string]

type Node added in v0.2.0

type Node interface {
	Name() string
	Kind() Kind
	// contains filtered or unexported methods
}

Node is any field definition that can be placed in Fields. Authors normally create nodes with constructors such as Text, Select, Group, or Array and use their concrete fluent methods before adding them to a field list. The interface is sealed so Ridu can snapshot every supported field safely.

type NumberField added in v0.2.0

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

NumberField configures a number field.

func AsNumber added in v0.2.0

func AsNumber(node Node) (NumberField, error)

AsNumber provides a checked concrete view of an immutable node.

func Number

func Number(name string) NumberField

Number creates a number field.

func (NumberField) Access added in v0.2.0

func (f NumberField) Access(value Access) NumberField

Access replaces the complete field access policy.

func (NumberField) AccessPolicy added in v0.2.0

func (v NumberField) AccessPolicy() Access

func (NumberField) Admin added in v0.2.0

func (f NumberField) Admin(value Admin) NumberField

Admin replaces the complete admin presentation policy.

func (NumberField) AdminPolicy added in v0.2.0

func (v NumberField) AdminPolicy() Admin

func (NumberField) AfterRead added in v0.2.2

func (f NumberField) AfterRead(callbacks ...OutputTransform[float64]) NumberField

AfterRead appends response transforms in order; no callbacks does nothing.

func (NumberField) AfterReadHooks added in v0.2.2

func (f NumberField) AfterReadHooks() []OutputTransform[float64]

AfterReadHooks returns a detached response-transform slice.

func (NumberField) AppendHooks added in v0.2.0

func (f NumberField) AppendHooks(value Hooks[float64]) NumberField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (NumberField) BehaviorSummary added in v0.2.0

func (v NumberField) BehaviorSummary() PolicySummary

func (NumberField) Children added in v0.2.0

func (v NumberField) Children() Fields

func (NumberField) Default added in v0.2.0

func (f NumberField) Default(value float64) NumberField

func (NumberField) DefaultCallback added in v0.2.0

func (f NumberField) DefaultCallback() DefaultFunc[float64]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (NumberField) DefaultFrom added in v0.2.0

func (f NumberField) DefaultFrom(callback DefaultFunc[float64]) NumberField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (NumberField) EditAdmin added in v0.2.0

func (f NumberField) EditAdmin(edit func(*Admin)) NumberField

EditAdmin updates selected admin settings while preserving the rest.

func (NumberField) HookPolicy added in v0.2.0

func (f NumberField) HookPolicy() Hooks[float64]

func (NumberField) Hooks added in v0.2.0

func (f NumberField) Hooks(value Hooks[float64]) NumberField

Hooks replaces the complete field lifecycle hook group.

func (NumberField) Index added in v0.2.0

func (f NumberField) Index(values ...bool) NumberField

func (NumberField) IsLocalized added in v0.2.0

func (v NumberField) IsLocalized() bool

func (NumberField) IsRequired added in v0.2.0

func (v NumberField) IsRequired() bool

func (NumberField) Kind added in v0.2.0

func (v NumberField) Kind() Kind

func (NumberField) Label added in v0.2.0

func (f NumberField) Label(value string) NumberField

func (NumberField) LabelText added in v0.2.0

func (v NumberField) LabelText() string

func (NumberField) LabelTranslations added in v0.2.0

func (f NumberField) LabelTranslations(values map[string]string) NumberField

func (NumberField) LiveValidate added in v0.2.0

func (f NumberField) LiveValidate(value LiveValidator[float64]) NumberField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (NumberField) LiveValidators added in v0.2.0

func (f NumberField) LiveValidators() []LiveValidator[float64]

LiveValidators returns a detached list of this field's advisory server checks.

func (NumberField) Localized added in v0.2.0

func (f NumberField) Localized(values ...bool) NumberField

func (NumberField) Max added in v0.2.0

func (f NumberField) Max(value float64) NumberField

func (NumberField) Min added in v0.2.0

func (f NumberField) Min(value float64) NumberField

func (NumberField) Name added in v0.2.0

func (v NumberField) Name() string

func (NumberField) PrependHooks added in v0.2.0

func (f NumberField) PrependHooks(value Hooks[float64]) NumberField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (NumberField) Private added in v0.2.0

func (f NumberField) Private(namespace string, value store.Value) NumberField

func (NumberField) Provenance added in v0.2.0

func (v NumberField) Provenance() []string

func (NumberField) Rename added in v0.2.0

func (f NumberField) Rename(name string) NumberField

func (NumberField) ReplaceAfterRead added in v0.2.2

func (f NumberField) ReplaceAfterRead(callbacks ...OutputTransform[float64]) NumberField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (NumberField) ReplaceLiveValidators added in v0.2.0

func (f NumberField) ReplaceLiveValidators(values ...LiveValidator[float64]) NumberField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (NumberField) ReplaceValidators added in v0.2.0

func (f NumberField) ReplaceValidators(values ...Validator[float64]) NumberField

ReplaceValidators replaces all authoritative save validators.

func (NumberField) Required added in v0.2.0

func (f NumberField) Required(values ...bool) NumberField

func (NumberField) RestrictAccess added in v0.2.0

func (f NumberField) RestrictAccess(value Access) NumberField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (NumberField) Step added in v0.2.0

func (f NumberField) Step(value float64) NumberField

func (NumberField) Unique added in v0.2.0

func (f NumberField) Unique(values ...bool) NumberField

func (NumberField) Validate added in v0.2.0

func (f NumberField) Validate(value Validator[float64]) NumberField

Validate appends one authoritative save validator.

func (NumberField) Validators added in v0.2.0

func (f NumberField) Validators() []Validator[float64]

type NumberListField added in v0.2.0

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

NumberListField configures one ordered list of finite numbers. It preserves duplicate values and has no per-item fields or persisted row identities.

func AsNumberList added in v0.2.0

func AsNumberList(node Node) (NumberListField, error)

AsNumberList provides a checked concrete view of an immutable primitive-list node.

func NumberList added in v0.2.0

func NumberList(name string) NumberListField

NumberList creates an ordered primitive list. Required demands a nonempty list; MinRows and MaxRows constrain its length independently of per-item constraints.

func (NumberListField) Access added in v0.2.0

func (f NumberListField) Access(value Access) NumberListField

Access replaces the complete field access policy.

func (NumberListField) AccessPolicy added in v0.2.0

func (v NumberListField) AccessPolicy() Access

func (NumberListField) Admin added in v0.2.0

func (f NumberListField) Admin(value Admin) NumberListField

Admin replaces the complete admin presentation policy.

func (NumberListField) AdminPolicy added in v0.2.0

func (v NumberListField) AdminPolicy() Admin

func (NumberListField) AfterRead added in v0.2.2

func (f NumberListField) AfterRead(callbacks ...OutputTransform[[]float64]) NumberListField

AfterRead appends response transforms in order; no callbacks does nothing.

func (NumberListField) AfterReadHooks added in v0.2.2

func (f NumberListField) AfterReadHooks() []OutputTransform[[]float64]

AfterReadHooks returns a detached response-transform slice.

func (NumberListField) AppendHooks added in v0.2.0

func (f NumberListField) AppendHooks(value Hooks[[]float64]) NumberListField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (NumberListField) BehaviorSummary added in v0.2.0

func (v NumberListField) BehaviorSummary() PolicySummary

func (NumberListField) Children added in v0.2.0

func (v NumberListField) Children() Fields

func (NumberListField) Default added in v0.2.0

func (f NumberListField) Default(values ...float64) NumberListField

Default sets a copied literal initial list. With no values it explicitly defaults to an empty list. It replaces any DefaultFrom callback.

func (NumberListField) DefaultCallback added in v0.2.0

func (f NumberListField) DefaultCallback() DefaultFunc[[]float64]

DefaultCallback returns the configured server default without executing it.

func (NumberListField) DefaultFrom added in v0.2.0

func (f NumberListField) DefaultFrom(callback DefaultFunc[[]float64]) NumberListField

DefaultFrom sets a typed server default using the ordinary initialization lifecycle.

func (NumberListField) EditAdmin added in v0.2.0

func (f NumberListField) EditAdmin(edit func(*Admin)) NumberListField

EditAdmin updates selected admin settings while preserving the rest.

func (NumberListField) HookPolicy added in v0.2.0

func (f NumberListField) HookPolicy() Hooks[[]float64]

func (NumberListField) Hooks added in v0.2.0

func (f NumberListField) Hooks(value Hooks[[]float64]) NumberListField

Hooks replaces the complete field lifecycle hook group.

func (NumberListField) IsLocalized added in v0.2.0

func (v NumberListField) IsLocalized() bool

func (NumberListField) IsRequired added in v0.2.0

func (v NumberListField) IsRequired() bool

func (NumberListField) Kind added in v0.2.0

func (v NumberListField) Kind() Kind

func (NumberListField) Label added in v0.2.0

func (f NumberListField) Label(value string) NumberListField

func (NumberListField) LabelText added in v0.2.0

func (v NumberListField) LabelText() string

func (NumberListField) LabelTranslations added in v0.2.0

func (f NumberListField) LabelTranslations(values map[string]string) NumberListField

func (NumberListField) LiveValidate added in v0.2.0

func (f NumberListField) LiveValidate(value LiveValidator[[]float64]) NumberListField

LiveValidate appends an advisory check for the complete primitive list. Items have no separate occurrence identity; Validate remains authoritative on Save.

func (NumberListField) LiveValidators added in v0.2.0

func (f NumberListField) LiveValidators() []LiveValidator[[]float64]

LiveValidators returns a detached list of whole-list advisory checks.

func (NumberListField) Localized added in v0.2.0

func (f NumberListField) Localized(values ...bool) NumberListField

func (NumberListField) Max added in v0.2.0

Max sets the inclusive upper bound for every number.

func (NumberListField) MaxRows added in v0.2.0

func (f NumberListField) MaxRows(value int) NumberListField

MaxRows limits the number of items; zero means no configured maximum.

func (NumberListField) Min added in v0.2.0

Min sets the inclusive lower bound for every number.

func (NumberListField) MinRows added in v0.2.0

func (f NumberListField) MinRows(value int) NumberListField

MinRows requires at least value items, including when the list is empty or null.

func (NumberListField) Name added in v0.2.0

func (v NumberListField) Name() string

func (NumberListField) PrependHooks added in v0.2.0

func (f NumberListField) PrependHooks(value Hooks[[]float64]) NumberListField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (NumberListField) Private added in v0.2.0

func (f NumberListField) Private(namespace string, value store.Value) NumberListField

func (NumberListField) Provenance added in v0.2.0

func (v NumberListField) Provenance() []string

func (NumberListField) Rename added in v0.2.0

func (f NumberListField) Rename(name string) NumberListField

func (NumberListField) ReplaceAfterRead added in v0.2.2

func (f NumberListField) ReplaceAfterRead(callbacks ...OutputTransform[[]float64]) NumberListField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (NumberListField) ReplaceLiveValidators added in v0.2.0

func (f NumberListField) ReplaceLiveValidators(values ...LiveValidator[[]float64]) NumberListField

ReplaceLiveValidators replaces only this field's advisory checks. An empty list disables live checks while preserving every unrelated policy.

func (NumberListField) ReplaceValidators added in v0.2.0

func (f NumberListField) ReplaceValidators(values ...Validator[[]float64]) NumberListField

ReplaceValidators replaces all authoritative save validators.

func (NumberListField) Required added in v0.2.0

func (f NumberListField) Required(values ...bool) NumberListField

func (NumberListField) RestrictAccess added in v0.2.0

func (f NumberListField) RestrictAccess(value Access) NumberListField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (NumberListField) Validate added in v0.2.0

func (f NumberListField) Validate(value Validator[[]float64]) NumberListField

Validate appends one authoritative save validator.

func (NumberListField) Validators added in v0.2.0

func (f NumberListField) Validators() []Validator[[]float64]

type Observer added in v0.2.0

type Observer[T any] func(operation.Context, operation.Value[T]) error

Observer runs code at a field lifecycle event. It receives the context and the field's value, but cannot return a replacement or mutate the context snapshots. Return nil to continue or an error to stop. Before commit, errors roll back the operation; an AfterCommit error reports failure after data has already saved.

type Option

type Option struct {
	// Value is the exact string stored in documents and sent over APIs.
	Value string
	// Label is the author-facing name shown in selection controls.
	// When omitted, resolution generates it from Value.
	Label string
	// LabelTranslations overrides Label for configured admin interface languages.
	LabelTranslations map[string]string
}

Option is one allowed value and its author-facing label for a select field.

type OutputField added in v0.2.0

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

OutputField configures a computed response value that cannot be set by a write request.

func AsOutput added in v0.2.0

func AsOutput(node Node) (OutputField, error)

AsOutput provides a checked concrete view of an immutable node.

func Virtual

func Virtual(name string, kind ValueType, resolver Resolver[store.Value]) OutputField

Virtual adds a computed field at the document root, using resolver to return its value.

func (OutputField) Access added in v0.2.0

func (f OutputField) Access(value Access) OutputField

Access replaces the complete field access policy.

func (OutputField) AccessPolicy added in v0.2.0

func (v OutputField) AccessPolicy() Access

func (OutputField) Admin added in v0.2.0

func (f OutputField) Admin(value Admin) OutputField

Admin replaces the complete admin presentation policy.

func (OutputField) AdminPolicy added in v0.2.0

func (v OutputField) AdminPolicy() Admin

func (OutputField) AfterRead added in v0.2.2

func (f OutputField) AfterRead(callbacks ...OutputTransform[store.Value]) OutputField

AfterRead appends response transforms in order; no callbacks does nothing.

func (OutputField) AfterReadHooks added in v0.2.2

func (f OutputField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (OutputField) BehaviorSummary added in v0.2.0

func (v OutputField) BehaviorSummary() PolicySummary

func (OutputField) Children added in v0.2.0

func (v OutputField) Children() Fields

func (OutputField) EditAdmin added in v0.2.0

func (f OutputField) EditAdmin(edit func(*Admin)) OutputField

EditAdmin updates selected admin settings while preserving the rest.

func (OutputField) IsLocalized added in v0.2.0

func (v OutputField) IsLocalized() bool

func (OutputField) IsRequired added in v0.2.0

func (v OutputField) IsRequired() bool

func (OutputField) Kind added in v0.2.0

func (v OutputField) Kind() Kind

func (OutputField) Label added in v0.2.0

func (f OutputField) Label(value string) OutputField

func (OutputField) LabelText added in v0.2.0

func (v OutputField) LabelText() string

func (OutputField) LabelTranslations added in v0.2.0

func (f OutputField) LabelTranslations(values map[string]string) OutputField

func (OutputField) Name added in v0.2.0

func (v OutputField) Name() string

func (OutputField) Private added in v0.2.0

func (f OutputField) Private(namespace string, value store.Value) OutputField

func (OutputField) Provenance added in v0.2.0

func (v OutputField) Provenance() []string

func (OutputField) Rename added in v0.2.0

func (f OutputField) Rename(name string) OutputField

func (OutputField) ReplaceAfterRead added in v0.2.2

func (f OutputField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) OutputField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (OutputField) Resolver added in v0.2.0

func (f OutputField) Resolver() Resolver[store.Value]

func (OutputField) RestrictAccess added in v0.2.0

func (f OutputField) RestrictAccess(value Access) OutputField

RestrictAccess combines supplied rules with existing access rules; both must allow.

type OutputTransform added in v0.2.0

type OutputTransform[T any] func(operation.Context, operation.Value[T]) (operation.Change[T], error)

OutputTransform changes one field in the response without changing storage. Its context supplies response values, which may include related documents and locale fallback. Return Keep or Replace, as for a write transform. Field read access still runs afterward; visible context data is not permission to expose it. AfterRead runs after resource response hooks on reads and mutation responses, before final field redaction. Registration determines the callback phase. An error stops the response and can roll back an uncommitted mutation.

type PluginField added in v0.2.0

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

PluginField configures a field provided by the named Go plugin.

func AsPlugin added in v0.2.0

func AsPlugin(node Node) (PluginField, error)

AsPlugin provides a checked concrete view of an immutable node.

func Plugin

func Plugin(name, key string, config json.RawMessage) PluginField

Plugin creates a field provided by the named Go plugin.

func (PluginField) Access added in v0.2.0

func (f PluginField) Access(value Access) PluginField

Access replaces the complete field access policy.

func (PluginField) AccessPolicy added in v0.2.0

func (v PluginField) AccessPolicy() Access

func (PluginField) Admin added in v0.2.0

func (f PluginField) Admin(value Admin) PluginField

Admin replaces the complete admin presentation policy.

func (PluginField) AdminPolicy added in v0.2.0

func (v PluginField) AdminPolicy() Admin

func (PluginField) AfterRead added in v0.2.2

func (f PluginField) AfterRead(callbacks ...OutputTransform[store.Value]) PluginField

AfterRead appends response transforms in order; no callbacks does nothing.

func (PluginField) AfterReadHooks added in v0.2.2

func (f PluginField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (PluginField) AppendHooks added in v0.2.0

func (f PluginField) AppendHooks(value Hooks[store.Value]) PluginField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (PluginField) BehaviorSummary added in v0.2.0

func (v PluginField) BehaviorSummary() PolicySummary

func (PluginField) Children added in v0.2.0

func (v PluginField) Children() Fields

func (PluginField) CollectionReferenceKeys added in v0.2.0

func (f PluginField) CollectionReferenceKeys(keys ...string) PluginField

func (PluginField) EditAdmin added in v0.2.0

func (f PluginField) EditAdmin(edit func(*Admin)) PluginField

EditAdmin updates selected admin settings while preserving the rest.

func (PluginField) EmbeddedTrees added in v0.2.0

func (f PluginField) EmbeddedTrees(trees ...EmbeddedTree) PluginField

func (PluginField) HookPolicy added in v0.2.0

func (f PluginField) HookPolicy() Hooks[store.Value]

func (PluginField) Hooks added in v0.2.0

func (f PluginField) Hooks(value Hooks[store.Value]) PluginField

Hooks replaces the complete field lifecycle hook group.

func (PluginField) IsLocalized added in v0.2.0

func (v PluginField) IsLocalized() bool

func (PluginField) IsRequired added in v0.2.0

func (v PluginField) IsRequired() bool

func (PluginField) Kind added in v0.2.0

func (v PluginField) Kind() Kind

func (PluginField) Label added in v0.2.0

func (f PluginField) Label(value string) PluginField

func (PluginField) LabelText added in v0.2.0

func (v PluginField) LabelText() string

func (PluginField) LabelTranslations added in v0.2.0

func (f PluginField) LabelTranslations(values map[string]string) PluginField

func (PluginField) LiveValidate added in v0.2.0

func (f PluginField) LiveValidate(value LiveValidator[store.Value]) PluginField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (PluginField) LiveValidators added in v0.2.0

func (f PluginField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (PluginField) Localized added in v0.2.0

func (f PluginField) Localized(values ...bool) PluginField

func (PluginField) Name added in v0.2.0

func (v PluginField) Name() string

func (PluginField) PrependHooks added in v0.2.0

func (f PluginField) PrependHooks(value Hooks[store.Value]) PluginField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (PluginField) Private added in v0.2.0

func (f PluginField) Private(namespace string, value store.Value) PluginField

func (PluginField) Provenance added in v0.2.0

func (v PluginField) Provenance() []string

func (PluginField) Rename added in v0.2.0

func (f PluginField) Rename(name string) PluginField

func (PluginField) ReplaceAfterRead added in v0.2.2

func (f PluginField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) PluginField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (PluginField) ReplaceLiveValidators added in v0.2.0

func (f PluginField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) PluginField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (PluginField) ReplaceValidators added in v0.2.0

func (f PluginField) ReplaceValidators(values ...Validator[store.Value]) PluginField

ReplaceValidators replaces all authoritative save validators.

func (PluginField) Required added in v0.2.0

func (f PluginField) Required(values ...bool) PluginField

func (PluginField) RestrictAccess added in v0.2.0

func (f PluginField) RestrictAccess(value Access) PluginField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (PluginField) Validate added in v0.2.0

func (f PluginField) Validate(value Validator[store.Value]) PluginField

Validate appends one authoritative save validator.

func (PluginField) Validators added in v0.2.0

func (f PluginField) Validators() []Validator[store.Value]

type PointField added in v0.2.0

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

PointField configures a field for a geographic point.

func AsPoint added in v0.2.0

func AsPoint(node Node) (PointField, error)

AsPoint provides a checked concrete view of an immutable node.

func Point

func Point(name string) PointField

Point creates a field for a geographic point.

func (PointField) Access added in v0.2.0

func (f PointField) Access(value Access) PointField

Access replaces the complete field access policy.

func (PointField) AccessPolicy added in v0.2.0

func (v PointField) AccessPolicy() Access

func (PointField) Admin added in v0.2.0

func (f PointField) Admin(value Admin) PointField

Admin replaces the complete admin presentation policy.

func (PointField) AdminPolicy added in v0.2.0

func (v PointField) AdminPolicy() Admin

func (PointField) AfterRead added in v0.2.2

func (f PointField) AfterRead(callbacks ...OutputTransform[store.Value]) PointField

AfterRead appends response transforms in order; no callbacks does nothing.

func (PointField) AfterReadHooks added in v0.2.2

func (f PointField) AfterReadHooks() []OutputTransform[store.Value]

AfterReadHooks returns a detached response-transform slice.

func (PointField) AppendHooks added in v0.2.0

func (f PointField) AppendHooks(value Hooks[store.Value]) PointField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (PointField) BehaviorSummary added in v0.2.0

func (v PointField) BehaviorSummary() PolicySummary

func (PointField) Children added in v0.2.0

func (v PointField) Children() Fields

func (PointField) EditAdmin added in v0.2.0

func (f PointField) EditAdmin(edit func(*Admin)) PointField

EditAdmin updates selected admin settings while preserving the rest.

func (PointField) HookPolicy added in v0.2.0

func (f PointField) HookPolicy() Hooks[store.Value]

func (PointField) Hooks added in v0.2.0

func (f PointField) Hooks(value Hooks[store.Value]) PointField

Hooks replaces the complete field lifecycle hook group.

func (PointField) IsLocalized added in v0.2.0

func (v PointField) IsLocalized() bool

func (PointField) IsRequired added in v0.2.0

func (v PointField) IsRequired() bool

func (PointField) Kind added in v0.2.0

func (v PointField) Kind() Kind

func (PointField) Label added in v0.2.0

func (f PointField) Label(value string) PointField

func (PointField) LabelText added in v0.2.0

func (v PointField) LabelText() string

func (PointField) LabelTranslations added in v0.2.0

func (f PointField) LabelTranslations(values map[string]string) PointField

func (PointField) LiveValidate added in v0.2.0

func (f PointField) LiveValidate(value LiveValidator[store.Value]) PointField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (PointField) LiveValidators added in v0.2.0

func (f PointField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (PointField) Localized added in v0.2.0

func (f PointField) Localized(values ...bool) PointField

func (PointField) Name added in v0.2.0

func (v PointField) Name() string

func (PointField) PrependHooks added in v0.2.0

func (f PointField) PrependHooks(value Hooks[store.Value]) PointField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (PointField) Private added in v0.2.0

func (f PointField) Private(namespace string, value store.Value) PointField

func (PointField) Provenance added in v0.2.0

func (v PointField) Provenance() []string

func (PointField) Rename added in v0.2.0

func (f PointField) Rename(name string) PointField

func (PointField) ReplaceAfterRead added in v0.2.2

func (f PointField) ReplaceAfterRead(callbacks ...OutputTransform[store.Value]) PointField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (PointField) ReplaceLiveValidators added in v0.2.0

func (f PointField) ReplaceLiveValidators(values ...LiveValidator[store.Value]) PointField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (PointField) ReplaceValidators added in v0.2.0

func (f PointField) ReplaceValidators(values ...Validator[store.Value]) PointField

ReplaceValidators replaces all authoritative save validators.

func (PointField) Required added in v0.2.0

func (f PointField) Required(values ...bool) PointField

func (PointField) RestrictAccess added in v0.2.0

func (f PointField) RestrictAccess(value Access) PointField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (PointField) Validate added in v0.2.0

func (f PointField) Validate(value Validator[store.Value]) PointField

Validate appends one authoritative save validator.

func (PointField) Validators added in v0.2.0

func (f PointField) Validators() []Validator[store.Value]

type PolicySummary added in v0.2.0

type PolicySummary struct {
	LiveValidators int            `json:"liveValidators,omitempty"`
	Validators     int            `json:"validators,omitempty"`
	Hooks          map[string]int `json:"hooks,omitempty"`
	CreateAccess   bool           `json:"createAccess,omitempty"`
	ReadAccess     bool           `json:"readAccess,omitempty"`
	UpdateAccess   bool           `json:"updateAccess,omitempty"`
	Resolver       bool           `json:"resolver,omitempty"`
	DynamicDefault bool           `json:"dynamicDefault,omitempty"`
}

PolicySummary is descriptive configuration evidence, never callback identity or a dispatch plan. No function address or captured state is serialized.

type PolymorphicRelationshipField added in v0.2.0

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

PolymorphicRelationshipField configures a link to one document from any of the target collections.

func AsPolymorphicRelationship added in v0.2.0

func AsPolymorphicRelationship(node Node) (PolymorphicRelationshipField, error)

AsPolymorphicRelationship provides a checked concrete view of an immutable node.

func PolymorphicRelationship added in v0.2.0

func PolymorphicRelationship(name string, targets ...schema.CollectionSlug) PolymorphicRelationshipField

PolymorphicRelationship creates a link to one document from any of the target collections.

func (PolymorphicRelationshipField) Access added in v0.2.0

Access replaces the complete field access policy.

func (PolymorphicRelationshipField) AccessPolicy added in v0.2.0

func (v PolymorphicRelationshipField) AccessPolicy() Access

func (PolymorphicRelationshipField) Admin added in v0.2.0

Admin replaces the complete admin presentation policy.

func (PolymorphicRelationshipField) AdminPolicy added in v0.2.0

func (v PolymorphicRelationshipField) AdminPolicy() Admin

func (PolymorphicRelationshipField) AfterRead added in v0.2.2

AfterRead appends response transforms in order; no callbacks does nothing.

func (PolymorphicRelationshipField) AfterReadHooks added in v0.2.2

AfterReadHooks returns a detached response-transform slice.

func (PolymorphicRelationshipField) AppendHooks added in v0.2.0

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (PolymorphicRelationshipField) BehaviorSummary added in v0.2.0

func (v PolymorphicRelationshipField) BehaviorSummary() PolicySummary

func (PolymorphicRelationshipField) Children added in v0.2.0

func (v PolymorphicRelationshipField) Children() Fields

func (PolymorphicRelationshipField) EditAdmin added in v0.2.0

EditAdmin updates selected admin settings while preserving the rest.

func (PolymorphicRelationshipField) FilterOptionRules added in v0.2.0

func (PolymorphicRelationshipField) HookPolicy added in v0.2.0

func (PolymorphicRelationshipField) Hooks added in v0.2.0

Hooks replaces the complete field lifecycle hook group.

func (PolymorphicRelationshipField) IsLocalized added in v0.2.0

func (v PolymorphicRelationshipField) IsLocalized() bool

func (PolymorphicRelationshipField) IsRequired added in v0.2.0

func (v PolymorphicRelationshipField) IsRequired() bool

func (PolymorphicRelationshipField) Kind added in v0.2.0

func (v PolymorphicRelationshipField) Kind() Kind

func (PolymorphicRelationshipField) Label added in v0.2.0

func (PolymorphicRelationshipField) LabelText added in v0.2.0

func (v PolymorphicRelationshipField) LabelText() string

func (PolymorphicRelationshipField) LabelTranslations added in v0.2.0

func (PolymorphicRelationshipField) LiveValidate added in v0.2.0

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (PolymorphicRelationshipField) LiveValidators added in v0.2.0

func (f PolymorphicRelationshipField) LiveValidators() []LiveValidator[store.Value]

LiveValidators returns a detached list of this field's advisory server checks.

func (PolymorphicRelationshipField) Localized added in v0.2.0

func (PolymorphicRelationshipField) Name added in v0.2.0

func (v PolymorphicRelationshipField) Name() string

func (PolymorphicRelationshipField) OnDelete added in v0.2.0

func (PolymorphicRelationshipField) PrependHooks added in v0.2.0

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (PolymorphicRelationshipField) Private added in v0.2.0

func (PolymorphicRelationshipField) Provenance added in v0.2.0

func (v PolymorphicRelationshipField) Provenance() []string

func (PolymorphicRelationshipField) Rename added in v0.2.0

func (PolymorphicRelationshipField) ReplaceAfterRead added in v0.2.2

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (PolymorphicRelationshipField) ReplaceLiveValidators added in v0.2.0

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (PolymorphicRelationshipField) ReplaceValidators added in v0.2.0

ReplaceValidators replaces all authoritative save validators.

func (PolymorphicRelationshipField) Required added in v0.2.0

func (PolymorphicRelationshipField) RestrictAccess added in v0.2.0

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (PolymorphicRelationshipField) Validate added in v0.2.0

Validate appends one authoritative save validator.

func (PolymorphicRelationshipField) Validators added in v0.2.0

type PolymorphicRelationshipsField added in v0.2.0

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

PolymorphicRelationshipsField configures links to documents from any of the target collections.

func AsPolymorphicRelationships added in v0.2.0

func AsPolymorphicRelationships(node Node) (PolymorphicRelationshipsField, error)

AsPolymorphicRelationships provides a checked concrete view of an immutable node.

func PolymorphicRelationships added in v0.2.0

func PolymorphicRelationships(name string, targets ...schema.CollectionSlug) PolymorphicRelationshipsField

PolymorphicRelationships creates links to documents from any of the target collections.

func (PolymorphicRelationshipsField) Access added in v0.2.0

Access replaces the complete field access policy.

func (PolymorphicRelationshipsField) AccessPolicy added in v0.2.0

func (v PolymorphicRelationshipsField) AccessPolicy() Access

func (PolymorphicRelationshipsField) Admin added in v0.2.0

Admin replaces the complete admin presentation policy.

func (PolymorphicRelationshipsField) AdminPolicy added in v0.2.0

func (v PolymorphicRelationshipsField) AdminPolicy() Admin

func (PolymorphicRelationshipsField) AfterRead added in v0.2.2

AfterRead appends response transforms in order; no callbacks does nothing.

func (PolymorphicRelationshipsField) AfterReadHooks added in v0.2.2

AfterReadHooks returns a detached response-transform slice.

func (PolymorphicRelationshipsField) AppendHooks added in v0.2.0

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (PolymorphicRelationshipsField) BehaviorSummary added in v0.2.0

func (v PolymorphicRelationshipsField) BehaviorSummary() PolicySummary

func (PolymorphicRelationshipsField) Children added in v0.2.0

func (v PolymorphicRelationshipsField) Children() Fields

func (PolymorphicRelationshipsField) EditAdmin added in v0.2.0

EditAdmin updates selected admin settings while preserving the rest.

func (PolymorphicRelationshipsField) FilterOptionRules added in v0.2.0

func (PolymorphicRelationshipsField) HookPolicy added in v0.2.0

func (PolymorphicRelationshipsField) Hooks added in v0.2.0

Hooks replaces the complete field lifecycle hook group.

func (PolymorphicRelationshipsField) IsLocalized added in v0.2.0

func (v PolymorphicRelationshipsField) IsLocalized() bool

func (PolymorphicRelationshipsField) IsRequired added in v0.2.0

func (v PolymorphicRelationshipsField) IsRequired() bool

func (PolymorphicRelationshipsField) Kind added in v0.2.0

func (v PolymorphicRelationshipsField) Kind() Kind

func (PolymorphicRelationshipsField) Label added in v0.2.0

func (PolymorphicRelationshipsField) LabelText added in v0.2.0

func (v PolymorphicRelationshipsField) LabelText() string

func (PolymorphicRelationshipsField) LabelTranslations added in v0.2.0

func (PolymorphicRelationshipsField) LiveValidate added in v0.2.0

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (PolymorphicRelationshipsField) LiveValidators added in v0.2.0

LiveValidators returns a detached list of this field's advisory server checks.

func (PolymorphicRelationshipsField) Localized added in v0.2.0

func (PolymorphicRelationshipsField) Name added in v0.2.0

func (v PolymorphicRelationshipsField) Name() string

func (PolymorphicRelationshipsField) OnDelete added in v0.2.0

func (PolymorphicRelationshipsField) PrependHooks added in v0.2.0

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (PolymorphicRelationshipsField) Private added in v0.2.0

func (PolymorphicRelationshipsField) Provenance added in v0.2.0

func (v PolymorphicRelationshipsField) Provenance() []string

func (PolymorphicRelationshipsField) Rename added in v0.2.0

func (PolymorphicRelationshipsField) ReplaceAfterRead added in v0.2.2

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (PolymorphicRelationshipsField) ReplaceLiveValidators added in v0.2.0

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (PolymorphicRelationshipsField) ReplaceValidators added in v0.2.0

ReplaceValidators replaces all authoritative save validators.

func (PolymorphicRelationshipsField) Required added in v0.2.0

func (PolymorphicRelationshipsField) RestrictAccess added in v0.2.0

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (PolymorphicRelationshipsField) Validate added in v0.2.0

Validate appends one authoritative save validator.

func (PolymorphicRelationshipsField) Validators added in v0.2.0

type RawTransform added in v0.2.0

RawTransform checks or changes one field before input is converted to its Go type. The context supplies surrounding values; the separate value is this field's raw input and may be invalid. Empty means omitted; Present(store.Null()) means explicit null. Return Keep to leave it unchanged, Replace to change this field, or an error to stop. Changing a context snapshot does not change the document.

type Reference added in v0.2.0

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

Reference is an immutable field selector. Its dot-separated path names stored fields through non-repeated groups or named tabs, excluding presentation wrappers and repeated row selectors. Each use resolves in its own field scope.

func Root added in v0.2.0

func Root(path string) Reference

Root selects a field path from the resource's document root.

func Sibling

func Sibling(path string) Reference

Sibling selects a field path in the enclosing object or repeated row.

func (Reference) Err added in v0.2.0

func (r Reference) Err() error

Err checks path structure. Configuration resolution checks target existence and rejects paths that cross repeated fields or end at incompatible values.

func (Reference) IsZero added in v0.2.0

func (r Reference) IsZero() bool

IsZero reports an unspecified reference.

func (Reference) MarshalJSON added in v0.2.0

func (r Reference) MarshalJSON() ([]byte, error)

MarshalJSON retains the authored scope and path.

func (Reference) Path added in v0.2.0

func (r Reference) Path() string

Path returns the authored dot-separated path relative to the starting scope.

func (Reference) Scope added in v0.2.0

func (r Reference) Scope() ReferenceScope

Scope returns the reference's starting object scope.

type ReferenceDeleteAction

type ReferenceDeleteAction string

ReferenceDeleteAction controls how a hard-deleted target affects current relationship and upload values that point at it. Historical version snapshots are immutable and are not reconciled by this policy.

const (
	// ReferenceDeleteNullify clears a singular reference or removes matching
	// members from a has-many reference.
	ReferenceDeleteNullify ReferenceDeleteAction = "nullify"
	// ReferenceDeleteRestrict rejects the target hard delete while a current
	// document still references it.
	ReferenceDeleteRestrict ReferenceDeleteAction = "restrict"
)

type ReferenceScope added in v0.2.0

type ReferenceScope string

ReferenceScope identifies the object from which a field reference is resolved.

const (
	SiblingScope ReferenceScope = "sibling"
	RootScope    ReferenceScope = "root"
)

type RelationshipField added in v0.2.0

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

RelationshipField configures a link to one document in the target collection.

func AsRelationship added in v0.2.0

func AsRelationship(node Node) (RelationshipField, error)

AsRelationship provides a checked concrete view of an immutable node.

func Relationship

func Relationship(name string, target schema.CollectionSlug) RelationshipField

Relationship creates a link to one document in the target collection.

func (RelationshipField) Access added in v0.2.0

func (f RelationshipField) Access(value Access) RelationshipField

Access replaces the complete field access policy.

func (RelationshipField) AccessPolicy added in v0.2.0

func (v RelationshipField) AccessPolicy() Access

func (RelationshipField) Admin added in v0.2.0

func (f RelationshipField) Admin(value Admin) RelationshipField

Admin replaces the complete admin presentation policy.

func (RelationshipField) AdminPolicy added in v0.2.0

func (v RelationshipField) AdminPolicy() Admin

func (RelationshipField) AfterRead added in v0.2.2

AfterRead appends response transforms in order; no callbacks does nothing.

func (RelationshipField) AfterReadHooks added in v0.2.2

AfterReadHooks returns a detached response-transform slice.

func (RelationshipField) AppendHooks added in v0.2.0

func (f RelationshipField) AppendHooks(value Hooks[operation.ID]) RelationshipField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (RelationshipField) BehaviorSummary added in v0.2.0

func (v RelationshipField) BehaviorSummary() PolicySummary

func (RelationshipField) Children added in v0.2.0

func (v RelationshipField) Children() Fields

func (RelationshipField) EditAdmin added in v0.2.0

func (f RelationshipField) EditAdmin(edit func(*Admin)) RelationshipField

EditAdmin updates selected admin settings while preserving the rest.

func (RelationshipField) FilterOptionRules added in v0.2.0

func (f RelationshipField) FilterOptionRules(rules ...RelationshipFilterRule) RelationshipField

func (RelationshipField) HookPolicy added in v0.2.0

func (f RelationshipField) HookPolicy() Hooks[operation.ID]

func (RelationshipField) Hooks added in v0.2.0

Hooks replaces the complete field lifecycle hook group.

func (RelationshipField) Index added in v0.2.0

func (f RelationshipField) Index(values ...bool) RelationshipField

func (RelationshipField) IsLocalized added in v0.2.0

func (v RelationshipField) IsLocalized() bool

func (RelationshipField) IsRequired added in v0.2.0

func (v RelationshipField) IsRequired() bool

func (RelationshipField) Kind added in v0.2.0

func (v RelationshipField) Kind() Kind

func (RelationshipField) Label added in v0.2.0

func (RelationshipField) LabelText added in v0.2.0

func (v RelationshipField) LabelText() string

func (RelationshipField) LabelTranslations added in v0.2.0

func (f RelationshipField) LabelTranslations(values map[string]string) RelationshipField

func (RelationshipField) LiveValidate added in v0.2.0

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (RelationshipField) LiveValidators added in v0.2.0

func (f RelationshipField) LiveValidators() []LiveValidator[operation.ID]

LiveValidators returns a detached list of this field's advisory server checks.

func (RelationshipField) Localized added in v0.2.0

func (f RelationshipField) Localized(values ...bool) RelationshipField

func (RelationshipField) Name added in v0.2.0

func (v RelationshipField) Name() string

func (RelationshipField) OnDelete added in v0.2.0

func (RelationshipField) PrependHooks added in v0.2.0

func (f RelationshipField) PrependHooks(value Hooks[operation.ID]) RelationshipField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (RelationshipField) Private added in v0.2.0

func (f RelationshipField) Private(namespace string, value store.Value) RelationshipField

func (RelationshipField) Provenance added in v0.2.0

func (v RelationshipField) Provenance() []string

func (RelationshipField) Rename added in v0.2.0

func (RelationshipField) ReplaceAfterRead added in v0.2.2

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (RelationshipField) ReplaceLiveValidators added in v0.2.0

func (f RelationshipField) ReplaceLiveValidators(values ...LiveValidator[operation.ID]) RelationshipField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (RelationshipField) ReplaceValidators added in v0.2.0

func (f RelationshipField) ReplaceValidators(values ...Validator[operation.ID]) RelationshipField

ReplaceValidators replaces all authoritative save validators.

func (RelationshipField) Required added in v0.2.0

func (f RelationshipField) Required(values ...bool) RelationshipField

func (RelationshipField) RestrictAccess added in v0.2.0

func (f RelationshipField) RestrictAccess(value Access) RelationshipField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (RelationshipField) Unique added in v0.2.0

func (f RelationshipField) Unique(values ...bool) RelationshipField

func (RelationshipField) Validate added in v0.2.0

Validate appends one authoritative save validator.

func (RelationshipField) Validators added in v0.2.0

func (f RelationshipField) Validators() []Validator[operation.ID]

type RelationshipFilterOperator

type RelationshipFilterOperator string

RelationshipFilterOperator is the finite predicate vocabulary used to narrow admin options.

const (
	FilterEquals           RelationshipFilterOperator = "equals"
	FilterNotEquals        RelationshipFilterOperator = "notEquals"
	FilterLike             RelationshipFilterOperator = "like"
	FilterContains         RelationshipFilterOperator = "contains"
	FilterGreaterThan      RelationshipFilterOperator = "greaterThan"
	FilterGreaterThanEqual RelationshipFilterOperator = "greaterThanEqual"
	FilterLessThan         RelationshipFilterOperator = "lessThan"
	FilterLessThanEqual    RelationshipFilterOperator = "lessThanEqual"
)

type RelationshipFilterRule

type RelationshipFilterRule struct {
	Collection string
	TargetPath string
	Operator   RelationshipFilterOperator
	SourcePath string
	Literal    *DefaultValue
}

RelationshipFilterRule derives one target predicate from current document data. Collection optionally limits the rule to one target of a polymorphic relationship.

func OptionFilter

func OptionFilter(targetPath string, operator RelationshipFilterOperator, sourcePath string) RelationshipFilterRule

OptionFilter derives one relationship-choice predicate from current document data.

func OptionFilterFor

func OptionFilterFor(collection, targetPath string, operator RelationshipFilterOperator, sourcePath string) RelationshipFilterRule

OptionFilterFor limits an option-filter rule to one target of a polymorphic relationship.

func OptionFilterValue

func OptionFilterValue[Value ~string | ~bool | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64](targetPath string, operator RelationshipFilterOperator, value Value) RelationshipFilterRule

OptionFilterValue compares a target field with one static scalar value. Literal filters are applied by both admin pickers and server-side reference admission.

func OptionFilterValueFor

func OptionFilterValueFor[Value ~string | ~bool | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64](collection, targetPath string, operator RelationshipFilterOperator, value Value) RelationshipFilterRule

OptionFilterValueFor limits a static option filter to one polymorphic target.

type RelationshipsField added in v0.2.0

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

RelationshipsField configures links to several documents in the target collection.

func AsRelationships added in v0.2.0

func AsRelationships(node Node) (RelationshipsField, error)

AsRelationships provides a checked concrete view of an immutable node.

func Relationships added in v0.2.0

func Relationships(name string, target schema.CollectionSlug) RelationshipsField

Relationships creates links to several documents in the target collection.

func (RelationshipsField) Access added in v0.2.0

Access replaces the complete field access policy.

func (RelationshipsField) AccessPolicy added in v0.2.0

func (v RelationshipsField) AccessPolicy() Access

func (RelationshipsField) Admin added in v0.2.0

Admin replaces the complete admin presentation policy.

func (RelationshipsField) AdminPolicy added in v0.2.0

func (v RelationshipsField) AdminPolicy() Admin

func (RelationshipsField) AfterRead added in v0.2.2

AfterRead appends response transforms in order; no callbacks does nothing.

func (RelationshipsField) AfterReadHooks added in v0.2.2

AfterReadHooks returns a detached response-transform slice.

func (RelationshipsField) AppendHooks added in v0.2.0

func (f RelationshipsField) AppendHooks(value Hooks[[]operation.ID]) RelationshipsField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (RelationshipsField) BehaviorSummary added in v0.2.0

func (v RelationshipsField) BehaviorSummary() PolicySummary

func (RelationshipsField) Children added in v0.2.0

func (v RelationshipsField) Children() Fields

func (RelationshipsField) EditAdmin added in v0.2.0

func (f RelationshipsField) EditAdmin(edit func(*Admin)) RelationshipsField

EditAdmin updates selected admin settings while preserving the rest.

func (RelationshipsField) FilterOptionRules added in v0.2.0

func (f RelationshipsField) FilterOptionRules(rules ...RelationshipFilterRule) RelationshipsField

func (RelationshipsField) HookPolicy added in v0.2.0

func (f RelationshipsField) HookPolicy() Hooks[[]operation.ID]

func (RelationshipsField) Hooks added in v0.2.0

Hooks replaces the complete field lifecycle hook group.

func (RelationshipsField) IsLocalized added in v0.2.0

func (v RelationshipsField) IsLocalized() bool

func (RelationshipsField) IsRequired added in v0.2.0

func (v RelationshipsField) IsRequired() bool

func (RelationshipsField) Kind added in v0.2.0

func (v RelationshipsField) Kind() Kind

func (RelationshipsField) Label added in v0.2.0

func (RelationshipsField) LabelText added in v0.2.0

func (v RelationshipsField) LabelText() string

func (RelationshipsField) LabelTranslations added in v0.2.0

func (f RelationshipsField) LabelTranslations(values map[string]string) RelationshipsField

func (RelationshipsField) LiveValidate added in v0.2.0

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (RelationshipsField) LiveValidators added in v0.2.0

func (f RelationshipsField) LiveValidators() []LiveValidator[[]operation.ID]

LiveValidators returns a detached list of this field's advisory server checks.

func (RelationshipsField) Localized added in v0.2.0

func (f RelationshipsField) Localized(values ...bool) RelationshipsField

func (RelationshipsField) Name added in v0.2.0

func (v RelationshipsField) Name() string

func (RelationshipsField) OnDelete added in v0.2.0

func (RelationshipsField) PrependHooks added in v0.2.0

func (f RelationshipsField) PrependHooks(value Hooks[[]operation.ID]) RelationshipsField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (RelationshipsField) Private added in v0.2.0

func (f RelationshipsField) Private(namespace string, value store.Value) RelationshipsField

func (RelationshipsField) Provenance added in v0.2.0

func (v RelationshipsField) Provenance() []string

func (RelationshipsField) Rename added in v0.2.0

func (RelationshipsField) ReplaceAfterRead added in v0.2.2

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (RelationshipsField) ReplaceLiveValidators added in v0.2.0

func (f RelationshipsField) ReplaceLiveValidators(values ...LiveValidator[[]operation.ID]) RelationshipsField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (RelationshipsField) ReplaceValidators added in v0.2.0

func (f RelationshipsField) ReplaceValidators(values ...Validator[[]operation.ID]) RelationshipsField

ReplaceValidators replaces all authoritative save validators.

func (RelationshipsField) Required added in v0.2.0

func (f RelationshipsField) Required(values ...bool) RelationshipsField

func (RelationshipsField) RestrictAccess added in v0.2.0

func (f RelationshipsField) RestrictAccess(value Access) RelationshipsField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (RelationshipsField) Validate added in v0.2.0

Validate appends one authoritative save validator.

func (RelationshipsField) Validators added in v0.2.0

func (f RelationshipsField) Validators() []Validator[[]operation.ID]

type Resolver added in v0.2.0

type Resolver[T any] func(operation.Context) (operation.Value[T], error)

Resolver calculates a root Virtual field for the response. Read other values from its context and return Present(value), Empty[T](), or an error. The value must match the declared Virtual type and remains subject to field read access.

type RowLabels

type RowLabels struct {
	Singular             string
	Plural               string
	SingularTranslations map[string]string
	PluralTranslations   map[string]string
}

RowLabels contains optional singular and plural display names for array rows. RowLabelPath remains the separate child-field path used to derive each row heading.

type SelectField added in v0.2.0

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

SelectField configures a field for choosing one value from a fixed list.

func AsSelect added in v0.2.0

func AsSelect(node Node) (SelectField, error)

AsSelect provides a checked concrete view of an immutable node.

func Radio

func Radio(name string, values ...string) SelectField

Radio creates a field for choosing one value with radio buttons. Values are stored exactly as given; display labels are generated during resolution. Use Options to configure custom labels or translations.

func Select

func Select(name string, values ...string) SelectField

Select creates a field for choosing one value from a fixed list. Values are stored exactly as given; display labels are generated during resolution. Use Options to configure custom labels or translations.

func (SelectField) Access added in v0.2.0

func (f SelectField) Access(value Access) SelectField

Access replaces the complete field access policy.

func (SelectField) AccessPolicy added in v0.2.0

func (v SelectField) AccessPolicy() Access

func (SelectField) Admin added in v0.2.0

func (f SelectField) Admin(value Admin) SelectField

Admin replaces the complete admin presentation policy.

func (SelectField) AdminPolicy added in v0.2.0

func (v SelectField) AdminPolicy() Admin

func (SelectField) AfterRead added in v0.2.2

func (f SelectField) AfterRead(callbacks ...OutputTransform[string]) SelectField

AfterRead appends response transforms in order; no callbacks does nothing.

func (SelectField) AfterReadHooks added in v0.2.2

func (f SelectField) AfterReadHooks() []OutputTransform[string]

AfterReadHooks returns a detached response-transform slice.

func (SelectField) AppendHooks added in v0.2.0

func (f SelectField) AppendHooks(value Hooks[string]) SelectField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (SelectField) BehaviorSummary added in v0.2.0

func (v SelectField) BehaviorSummary() PolicySummary

func (SelectField) Children added in v0.2.0

func (v SelectField) Children() Fields

func (SelectField) Default added in v0.2.0

func (f SelectField) Default(value string) SelectField

func (SelectField) DefaultCallback added in v0.2.0

func (f SelectField) DefaultCallback() DefaultFunc[string]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (SelectField) DefaultFrom added in v0.2.0

func (f SelectField) DefaultFrom(callback DefaultFunc[string]) SelectField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (SelectField) EditAdmin added in v0.2.0

func (f SelectField) EditAdmin(edit func(*Admin)) SelectField

EditAdmin updates selected admin settings while preserving the rest.

func (SelectField) HookPolicy added in v0.2.0

func (f SelectField) HookPolicy() Hooks[string]

func (SelectField) Hooks added in v0.2.0

func (f SelectField) Hooks(value Hooks[string]) SelectField

Hooks replaces the complete field lifecycle hook group.

func (SelectField) Index added in v0.2.0

func (f SelectField) Index(values ...bool) SelectField

func (SelectField) IsLocalized added in v0.2.0

func (v SelectField) IsLocalized() bool

func (SelectField) IsRequired added in v0.2.0

func (v SelectField) IsRequired() bool

func (SelectField) Kind added in v0.2.0

func (v SelectField) Kind() Kind

func (SelectField) Label added in v0.2.0

func (f SelectField) Label(value string) SelectField

func (SelectField) LabelText added in v0.2.0

func (v SelectField) LabelText() string

func (SelectField) LabelTranslations added in v0.2.0

func (f SelectField) LabelTranslations(values map[string]string) SelectField

func (SelectField) LiveValidate added in v0.2.0

func (f SelectField) LiveValidate(value LiveValidator[string]) SelectField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (SelectField) LiveValidators added in v0.2.0

func (f SelectField) LiveValidators() []LiveValidator[string]

LiveValidators returns a detached list of this field's advisory server checks.

func (SelectField) Localized added in v0.2.0

func (f SelectField) Localized(values ...bool) SelectField

func (SelectField) Name added in v0.2.0

func (v SelectField) Name() string

func (SelectField) Options added in v0.2.0

func (f SelectField) Options(values ...Option) SelectField

Options replaces the option list with options that can include labels and translations.

func (SelectField) PrependHooks added in v0.2.0

func (f SelectField) PrependHooks(value Hooks[string]) SelectField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (SelectField) Private added in v0.2.0

func (f SelectField) Private(namespace string, value store.Value) SelectField

func (SelectField) Provenance added in v0.2.0

func (v SelectField) Provenance() []string

func (SelectField) Rename added in v0.2.0

func (f SelectField) Rename(name string) SelectField

func (SelectField) ReplaceAfterRead added in v0.2.2

func (f SelectField) ReplaceAfterRead(callbacks ...OutputTransform[string]) SelectField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (SelectField) ReplaceLiveValidators added in v0.2.0

func (f SelectField) ReplaceLiveValidators(values ...LiveValidator[string]) SelectField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (SelectField) ReplaceValidators added in v0.2.0

func (f SelectField) ReplaceValidators(values ...Validator[string]) SelectField

ReplaceValidators replaces all authoritative save validators.

func (SelectField) Required added in v0.2.0

func (f SelectField) Required(values ...bool) SelectField

func (SelectField) RestrictAccess added in v0.2.0

func (f SelectField) RestrictAccess(value Access) SelectField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (SelectField) Unique added in v0.2.0

func (f SelectField) Unique(values ...bool) SelectField

func (SelectField) Validate added in v0.2.0

func (f SelectField) Validate(value Validator[string]) SelectField

Validate appends one authoritative save validator.

func (SelectField) Validators added in v0.2.0

func (f SelectField) Validators() []Validator[string]

type TextField added in v0.2.0

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

TextField configures a Text, Code, or Textarea string field.

func AsText added in v0.2.0

func AsText(node Node) (TextField, error)

AsText provides a checked concrete view of an immutable node.

func Code

func Code(name string) TextField

Code creates a text field with a code editor.

func Slug

func Slug(name, sourcePath string) TextField

Slug defines a required, unique, indexed text field whose value is generated from sourcePath until an author supplies a manual value. The source may be a direct string field or a string field beneath non-repeated groups.

Slugs intentionally use ordinary text storage and generated string contracts. Localization and defaults are not supported by this first-class helper.

func Text

func Text(name string) TextField

Text creates a single-line text field.

func Textarea

func Textarea(name string) TextField

Textarea creates a multi-line text field.

func (TextField) Access added in v0.2.0

func (f TextField) Access(value Access) TextField

Access replaces the complete field access policy.

func (TextField) AccessPolicy added in v0.2.0

func (v TextField) AccessPolicy() Access

func (TextField) Admin added in v0.2.0

func (f TextField) Admin(value Admin) TextField

Admin replaces the complete admin presentation policy.

func (TextField) AdminPolicy added in v0.2.0

func (v TextField) AdminPolicy() Admin

func (TextField) AfterRead added in v0.2.2

func (f TextField) AfterRead(callbacks ...OutputTransform[string]) TextField

AfterRead appends response transforms in order; no callbacks does nothing.

func (TextField) AfterReadHooks added in v0.2.2

func (f TextField) AfterReadHooks() []OutputTransform[string]

AfterReadHooks returns a detached response-transform slice.

func (TextField) AppendHooks added in v0.2.0

func (f TextField) AppendHooks(value Hooks[string]) TextField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (TextField) BehaviorSummary added in v0.2.0

func (v TextField) BehaviorSummary() PolicySummary

func (TextField) Children added in v0.2.0

func (v TextField) Children() Fields

func (TextField) Default added in v0.2.0

func (f TextField) Default(value string) TextField

func (TextField) DefaultCallback added in v0.2.0

func (f TextField) DefaultCallback() DefaultFunc[string]

DefaultCallback returns the configured dynamic default, or nil for a literal default or no default. Callback closure captures remain application-owned.

func (TextField) DefaultFrom added in v0.2.0

func (f TextField) DefaultFrom(callback DefaultFunc[string]) TextField

DefaultFrom supplies a server-side initial value for an eligible omitted field. It replaces a literal or dynamic default; the original field is unchanged. See DefaultFunc and operation.Context for initialization semantics.

func (TextField) EditAdmin added in v0.2.0

func (f TextField) EditAdmin(edit func(*Admin)) TextField

EditAdmin updates selected admin settings while preserving the rest.

func (TextField) HookPolicy added in v0.2.0

func (f TextField) HookPolicy() Hooks[string]

func (TextField) Hooks added in v0.2.0

func (f TextField) Hooks(value Hooks[string]) TextField

Hooks replaces the complete field lifecycle hook group.

func (TextField) Index added in v0.2.0

func (f TextField) Index(values ...bool) TextField

func (TextField) IsLocalized added in v0.2.0

func (v TextField) IsLocalized() bool

func (TextField) IsRequired added in v0.2.0

func (v TextField) IsRequired() bool

func (TextField) Kind added in v0.2.0

func (v TextField) Kind() Kind

func (TextField) Label added in v0.2.0

func (f TextField) Label(value string) TextField

func (TextField) LabelText added in v0.2.0

func (v TextField) LabelText() string

func (TextField) LabelTranslations added in v0.2.0

func (f TextField) LabelTranslations(values map[string]string) TextField

func (TextField) LiveValidate added in v0.2.0

func (f TextField) LiveValidate(value LiveValidator[string]) TextField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (TextField) LiveValidators added in v0.2.0

func (f TextField) LiveValidators() []LiveValidator[string]

LiveValidators returns a detached list of this field's advisory server checks.

func (TextField) Localized added in v0.2.0

func (f TextField) Localized(values ...bool) TextField

func (TextField) MaxLength added in v0.2.0

func (f TextField) MaxLength(value int) TextField

func (TextField) MinLength added in v0.2.0

func (f TextField) MinLength(value int) TextField

func (TextField) Name added in v0.2.0

func (v TextField) Name() string

func (TextField) PrependHooks added in v0.2.0

func (f TextField) PrependHooks(value Hooks[string]) TextField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (TextField) Private added in v0.2.0

func (f TextField) Private(namespace string, value store.Value) TextField

func (TextField) Provenance added in v0.2.0

func (v TextField) Provenance() []string

func (TextField) Rename added in v0.2.0

func (f TextField) Rename(name string) TextField

func (TextField) ReplaceAfterRead added in v0.2.2

func (f TextField) ReplaceAfterRead(callbacks ...OutputTransform[string]) TextField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (TextField) ReplaceLiveValidators added in v0.2.0

func (f TextField) ReplaceLiveValidators(values ...LiveValidator[string]) TextField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (TextField) ReplaceValidators added in v0.2.0

func (f TextField) ReplaceValidators(values ...Validator[string]) TextField

ReplaceValidators replaces all authoritative save validators.

func (TextField) Required added in v0.2.0

func (f TextField) Required(values ...bool) TextField

func (TextField) RestrictAccess added in v0.2.0

func (f TextField) RestrictAccess(value Access) TextField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (TextField) Unique added in v0.2.0

func (f TextField) Unique(values ...bool) TextField

func (TextField) Validate added in v0.2.0

func (f TextField) Validate(value Validator[string]) TextField

Validate appends one authoritative save validator.

func (TextField) Validators added in v0.2.0

func (f TextField) Validators() []Validator[string]

type TextListField added in v0.2.0

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

TextListField configures one ordered list of strings. It preserves duplicate values and has no per-item fields or persisted row identities.

func AsTextList added in v0.2.0

func AsTextList(node Node) (TextListField, error)

AsTextList provides a checked concrete view of an immutable primitive-list node.

func TextList added in v0.2.0

func TextList(name string) TextListField

TextList creates an ordered primitive list. Required demands a nonempty list; MinRows and MaxRows constrain its length independently of per-item constraints.

func (TextListField) Access added in v0.2.0

func (f TextListField) Access(value Access) TextListField

Access replaces the complete field access policy.

func (TextListField) AccessPolicy added in v0.2.0

func (v TextListField) AccessPolicy() Access

func (TextListField) Admin added in v0.2.0

func (f TextListField) Admin(value Admin) TextListField

Admin replaces the complete admin presentation policy.

func (TextListField) AdminPolicy added in v0.2.0

func (v TextListField) AdminPolicy() Admin

func (TextListField) AfterRead added in v0.2.2

func (f TextListField) AfterRead(callbacks ...OutputTransform[[]string]) TextListField

AfterRead appends response transforms in order; no callbacks does nothing.

func (TextListField) AfterReadHooks added in v0.2.2

func (f TextListField) AfterReadHooks() []OutputTransform[[]string]

AfterReadHooks returns a detached response-transform slice.

func (TextListField) AppendHooks added in v0.2.0

func (f TextListField) AppendHooks(value Hooks[[]string]) TextListField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (TextListField) BehaviorSummary added in v0.2.0

func (v TextListField) BehaviorSummary() PolicySummary

func (TextListField) Children added in v0.2.0

func (v TextListField) Children() Fields

func (TextListField) Default added in v0.2.0

func (f TextListField) Default(values ...string) TextListField

Default sets a copied literal initial list. With no values it explicitly defaults to an empty list. It replaces any DefaultFrom callback.

func (TextListField) DefaultCallback added in v0.2.0

func (f TextListField) DefaultCallback() DefaultFunc[[]string]

DefaultCallback returns the configured server default without executing it.

func (TextListField) DefaultFrom added in v0.2.0

func (f TextListField) DefaultFrom(callback DefaultFunc[[]string]) TextListField

DefaultFrom sets a typed server default using the ordinary initialization lifecycle.

func (TextListField) EditAdmin added in v0.2.0

func (f TextListField) EditAdmin(edit func(*Admin)) TextListField

EditAdmin updates selected admin settings while preserving the rest.

func (TextListField) HookPolicy added in v0.2.0

func (f TextListField) HookPolicy() Hooks[[]string]

func (TextListField) Hooks added in v0.2.0

func (f TextListField) Hooks(value Hooks[[]string]) TextListField

Hooks replaces the complete field lifecycle hook group.

func (TextListField) IsLocalized added in v0.2.0

func (v TextListField) IsLocalized() bool

func (TextListField) IsRequired added in v0.2.0

func (v TextListField) IsRequired() bool

func (TextListField) Kind added in v0.2.0

func (v TextListField) Kind() Kind

func (TextListField) Label added in v0.2.0

func (f TextListField) Label(value string) TextListField

func (TextListField) LabelText added in v0.2.0

func (v TextListField) LabelText() string

func (TextListField) LabelTranslations added in v0.2.0

func (f TextListField) LabelTranslations(values map[string]string) TextListField

func (TextListField) LiveValidate added in v0.2.0

func (f TextListField) LiveValidate(value LiveValidator[[]string]) TextListField

LiveValidate appends an advisory check for the complete primitive list. Items have no separate occurrence identity; Validate remains authoritative on Save.

func (TextListField) LiveValidators added in v0.2.0

func (f TextListField) LiveValidators() []LiveValidator[[]string]

LiveValidators returns a detached list of whole-list advisory checks.

func (TextListField) Localized added in v0.2.0

func (f TextListField) Localized(values ...bool) TextListField

func (TextListField) MaxLength added in v0.2.0

func (f TextListField) MaxLength(value int) TextListField

MaxLength limits each string's Unicode code point count.

func (TextListField) MaxRows added in v0.2.0

func (f TextListField) MaxRows(value int) TextListField

MaxRows limits the number of items; zero means no configured maximum.

func (TextListField) MinLength added in v0.2.0

func (f TextListField) MinLength(value int) TextListField

MinLength requires each string to contain at least value Unicode code points.

func (TextListField) MinRows added in v0.2.0

func (f TextListField) MinRows(value int) TextListField

MinRows requires at least value items, including when the list is empty or null.

func (TextListField) Name added in v0.2.0

func (v TextListField) Name() string

func (TextListField) PrependHooks added in v0.2.0

func (f TextListField) PrependHooks(value Hooks[[]string]) TextListField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (TextListField) Private added in v0.2.0

func (f TextListField) Private(namespace string, value store.Value) TextListField

func (TextListField) Provenance added in v0.2.0

func (v TextListField) Provenance() []string

func (TextListField) Rename added in v0.2.0

func (f TextListField) Rename(name string) TextListField

func (TextListField) ReplaceAfterRead added in v0.2.2

func (f TextListField) ReplaceAfterRead(callbacks ...OutputTransform[[]string]) TextListField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (TextListField) ReplaceLiveValidators added in v0.2.0

func (f TextListField) ReplaceLiveValidators(values ...LiveValidator[[]string]) TextListField

ReplaceLiveValidators replaces only this field's advisory checks. An empty list disables live checks while preserving every unrelated policy.

func (TextListField) ReplaceValidators added in v0.2.0

func (f TextListField) ReplaceValidators(values ...Validator[[]string]) TextListField

ReplaceValidators replaces all authoritative save validators.

func (TextListField) Required added in v0.2.0

func (f TextListField) Required(values ...bool) TextListField

func (TextListField) RestrictAccess added in v0.2.0

func (f TextListField) RestrictAccess(value Access) TextListField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (TextListField) Validate added in v0.2.0

func (f TextListField) Validate(value Validator[[]string]) TextListField

Validate appends one authoritative save validator.

func (TextListField) Validators added in v0.2.0

func (f TextListField) Validators() []Validator[[]string]

type Transform added in v0.2.0

type Transform[T any] func(operation.Context, operation.Value[T]) (operation.Change[T], error)

Transform checks or changes one field's typed value before saving. The context includes unchanged values from an update and changes made by earlier hooks. Return Keep to leave this field unchanged, Replace(Present(value)) to set it, or Replace(Empty[T]()) to clear it. An error stops the operation. Returned values still pass through validation and field access checks.

type UploadField added in v0.2.0

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

UploadField configures a link to one file in the target upload collection.

func AsUpload added in v0.2.0

func AsUpload(node Node) (UploadField, error)

AsUpload provides a checked concrete view of an immutable node.

func Upload

func Upload(name string, target schema.CollectionSlug) UploadField

Upload creates a link to one file in the target upload collection.

func (UploadField) Access added in v0.2.0

func (f UploadField) Access(value Access) UploadField

Access replaces the complete field access policy.

func (UploadField) AccessPolicy added in v0.2.0

func (v UploadField) AccessPolicy() Access

func (UploadField) Admin added in v0.2.0

func (f UploadField) Admin(value Admin) UploadField

Admin replaces the complete admin presentation policy.

func (UploadField) AdminPolicy added in v0.2.0

func (v UploadField) AdminPolicy() Admin

func (UploadField) AfterRead added in v0.2.2

AfterRead appends response transforms in order; no callbacks does nothing.

func (UploadField) AfterReadHooks added in v0.2.2

func (f UploadField) AfterReadHooks() []OutputTransform[operation.ReferenceOutput]

AfterReadHooks returns a detached response-transform slice.

func (UploadField) AppendHooks added in v0.2.0

func (f UploadField) AppendHooks(value Hooks[operation.ID]) UploadField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (UploadField) BehaviorSummary added in v0.2.0

func (v UploadField) BehaviorSummary() PolicySummary

func (UploadField) Children added in v0.2.0

func (v UploadField) Children() Fields

func (UploadField) EditAdmin added in v0.2.0

func (f UploadField) EditAdmin(edit func(*Admin)) UploadField

EditAdmin updates selected admin settings while preserving the rest.

func (UploadField) FilterOptionRules added in v0.2.0

func (f UploadField) FilterOptionRules(rules ...RelationshipFilterRule) UploadField

func (UploadField) HookPolicy added in v0.2.0

func (f UploadField) HookPolicy() Hooks[operation.ID]

func (UploadField) Hooks added in v0.2.0

func (f UploadField) Hooks(value Hooks[operation.ID]) UploadField

Hooks replaces the complete field lifecycle hook group.

func (UploadField) Index added in v0.2.0

func (f UploadField) Index(values ...bool) UploadField

func (UploadField) IsLocalized added in v0.2.0

func (v UploadField) IsLocalized() bool

func (UploadField) IsRequired added in v0.2.0

func (v UploadField) IsRequired() bool

func (UploadField) Kind added in v0.2.0

func (v UploadField) Kind() Kind

func (UploadField) Label added in v0.2.0

func (f UploadField) Label(value string) UploadField

func (UploadField) LabelText added in v0.2.0

func (v UploadField) LabelText() string

func (UploadField) LabelTranslations added in v0.2.0

func (f UploadField) LabelTranslations(values map[string]string) UploadField

func (UploadField) LiveValidate added in v0.2.0

func (f UploadField) LiveValidate(value LiveValidator[operation.ID]) UploadField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (UploadField) LiveValidators added in v0.2.0

func (f UploadField) LiveValidators() []LiveValidator[operation.ID]

LiveValidators returns a detached list of this field's advisory server checks.

func (UploadField) Localized added in v0.2.0

func (f UploadField) Localized(values ...bool) UploadField

func (UploadField) Name added in v0.2.0

func (v UploadField) Name() string

func (UploadField) OnDelete added in v0.2.0

func (f UploadField) OnDelete(value ReferenceDeleteAction) UploadField

func (UploadField) PrependHooks added in v0.2.0

func (f UploadField) PrependHooks(value Hooks[operation.ID]) UploadField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (UploadField) Private added in v0.2.0

func (f UploadField) Private(namespace string, value store.Value) UploadField

func (UploadField) Provenance added in v0.2.0

func (v UploadField) Provenance() []string

func (UploadField) Rename added in v0.2.0

func (f UploadField) Rename(name string) UploadField

func (UploadField) ReplaceAfterRead added in v0.2.2

func (f UploadField) ReplaceAfterRead(callbacks ...OutputTransform[operation.ReferenceOutput]) UploadField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (UploadField) ReplaceLiveValidators added in v0.2.0

func (f UploadField) ReplaceLiveValidators(values ...LiveValidator[operation.ID]) UploadField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (UploadField) ReplaceValidators added in v0.2.0

func (f UploadField) ReplaceValidators(values ...Validator[operation.ID]) UploadField

ReplaceValidators replaces all authoritative save validators.

func (UploadField) Required added in v0.2.0

func (f UploadField) Required(values ...bool) UploadField

func (UploadField) RestrictAccess added in v0.2.0

func (f UploadField) RestrictAccess(value Access) UploadField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (UploadField) Unique added in v0.2.0

func (f UploadField) Unique(values ...bool) UploadField

func (UploadField) Validate added in v0.2.0

func (f UploadField) Validate(value Validator[operation.ID]) UploadField

Validate appends one authoritative save validator.

func (UploadField) Validators added in v0.2.0

func (f UploadField) Validators() []Validator[operation.ID]

type UploadsField added in v0.2.0

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

UploadsField configures links to several files in the target upload collection.

func AsUploads added in v0.2.0

func AsUploads(node Node) (UploadsField, error)

AsUploads provides a checked concrete view of an immutable node.

func Uploads added in v0.2.0

func Uploads(name string, target schema.CollectionSlug) UploadsField

Uploads creates links to several files in the target upload collection.

func (UploadsField) Access added in v0.2.0

func (f UploadsField) Access(value Access) UploadsField

Access replaces the complete field access policy.

func (UploadsField) AccessPolicy added in v0.2.0

func (v UploadsField) AccessPolicy() Access

func (UploadsField) Admin added in v0.2.0

func (f UploadsField) Admin(value Admin) UploadsField

Admin replaces the complete admin presentation policy.

func (UploadsField) AdminPolicy added in v0.2.0

func (v UploadsField) AdminPolicy() Admin

func (UploadsField) AfterRead added in v0.2.2

func (f UploadsField) AfterRead(callbacks ...OutputTransform[[]operation.ReferenceOutput]) UploadsField

AfterRead appends response transforms in order; no callbacks does nothing.

func (UploadsField) AfterReadHooks added in v0.2.2

func (f UploadsField) AfterReadHooks() []OutputTransform[[]operation.ReferenceOutput]

AfterReadHooks returns a detached response-transform slice.

func (UploadsField) AppendHooks added in v0.2.0

func (f UploadsField) AppendHooks(value Hooks[[]operation.ID]) UploadsField

AppendHooks appends supplied callbacks after existing callbacks in each phase.

func (UploadsField) BehaviorSummary added in v0.2.0

func (v UploadsField) BehaviorSummary() PolicySummary

func (UploadsField) Children added in v0.2.0

func (v UploadsField) Children() Fields

func (UploadsField) EditAdmin added in v0.2.0

func (f UploadsField) EditAdmin(edit func(*Admin)) UploadsField

EditAdmin updates selected admin settings while preserving the rest.

func (UploadsField) FilterOptionRules added in v0.2.0

func (f UploadsField) FilterOptionRules(rules ...RelationshipFilterRule) UploadsField

func (UploadsField) HookPolicy added in v0.2.0

func (f UploadsField) HookPolicy() Hooks[[]operation.ID]

func (UploadsField) Hooks added in v0.2.0

func (f UploadsField) Hooks(value Hooks[[]operation.ID]) UploadsField

Hooks replaces the complete field lifecycle hook group.

func (UploadsField) IsLocalized added in v0.2.0

func (v UploadsField) IsLocalized() bool

func (UploadsField) IsRequired added in v0.2.0

func (v UploadsField) IsRequired() bool

func (UploadsField) Kind added in v0.2.0

func (v UploadsField) Kind() Kind

func (UploadsField) Label added in v0.2.0

func (f UploadsField) Label(value string) UploadsField

func (UploadsField) LabelText added in v0.2.0

func (v UploadsField) LabelText() string

func (UploadsField) LabelTranslations added in v0.2.0

func (f UploadsField) LabelTranslations(values map[string]string) UploadsField

func (UploadsField) LiveValidate added in v0.2.0

func (f UploadsField) LiveValidate(value LiveValidator[[]operation.ID]) UploadsField

LiveValidate appends an explicitly opted-in advisory server check. It does not register a save validator; use Validate separately for authoritative checks.

func (UploadsField) LiveValidators added in v0.2.0

func (f UploadsField) LiveValidators() []LiveValidator[[]operation.ID]

LiveValidators returns a detached list of this field's advisory server checks.

func (UploadsField) Localized added in v0.2.0

func (f UploadsField) Localized(values ...bool) UploadsField

func (UploadsField) Name added in v0.2.0

func (v UploadsField) Name() string

func (UploadsField) OnDelete added in v0.2.0

func (UploadsField) PrependHooks added in v0.2.0

func (f UploadsField) PrependHooks(value Hooks[[]operation.ID]) UploadsField

PrependHooks inserts supplied callbacks before existing callbacks in each phase.

func (UploadsField) Private added in v0.2.0

func (f UploadsField) Private(namespace string, value store.Value) UploadsField

func (UploadsField) Provenance added in v0.2.0

func (v UploadsField) Provenance() []string

func (UploadsField) Rename added in v0.2.0

func (f UploadsField) Rename(name string) UploadsField

func (UploadsField) ReplaceAfterRead added in v0.2.2

func (f UploadsField) ReplaceAfterRead(callbacks ...OutputTransform[[]operation.ReferenceOutput]) UploadsField

ReplaceAfterRead replaces response transforms; no callbacks clears them.

func (UploadsField) ReplaceLiveValidators added in v0.2.0

func (f UploadsField) ReplaceLiveValidators(values ...LiveValidator[[]operation.ID]) UploadsField

ReplaceLiveValidators replaces this field's advisory checks, preserving its save validators and every unrelated policy. An empty list disables live checks.

func (UploadsField) ReplaceValidators added in v0.2.0

func (f UploadsField) ReplaceValidators(values ...Validator[[]operation.ID]) UploadsField

ReplaceValidators replaces all authoritative save validators.

func (UploadsField) Required added in v0.2.0

func (f UploadsField) Required(values ...bool) UploadsField

func (UploadsField) RestrictAccess added in v0.2.0

func (f UploadsField) RestrictAccess(value Access) UploadsField

RestrictAccess combines supplied rules with existing access rules; both must allow.

func (UploadsField) Validate added in v0.2.0

func (f UploadsField) Validate(value Validator[[]operation.ID]) UploadsField

Validate appends one authoritative save validator.

func (UploadsField) Validators added in v0.2.0

func (f UploadsField) Validators() []Validator[[]operation.ID]

type Validator added in v0.2.0

type Validator[T any] func(operation.Context, operation.Value[T]) ([]operation.Issue, error)

Validator checks a field before saving, after built-in checks and write hooks. Root and Siblings include retained values and earlier write transformations; Prior remains the persisted enclosing object or row. LiveValidationContext instead describes sparse input before defaults and save transformations. Return issues for values the author needs to fix, or an error if the check could not run. An issue belongs to this field unless its Target names a child.

type ValueType

type ValueType string

ValueType identifies the generated and runtime value contract of a virtual field.

const (
	ValueString  ValueType = "string"
	ValueNumber  ValueType = "number"
	ValueBoolean ValueType = "boolean"
	ValueJSON    ValueType = "json"
)

type View added in v0.2.0

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

View is a read-only snapshot of a canonical immutable node. Its readers detach mutable values; author fields through their concrete fluent facades.

func Snapshot added in v0.2.0

func Snapshot(n Node) View

Snapshot captures even pointer-to-facade inputs by value. Invalid nil nodes become diagnostic definitions, so composition never panics on caller input.

func (View) AccessPolicy added in v0.2.0

func (d View) AccessPolicy() Access

AccessPolicy returns the immutable function group; closure captures remain author-owned.

func (View) AdminComponent added in v0.2.0

func (d View) AdminComponent() (pluginKey, component string, config json.RawMessage, ok bool)

AdminComponent returns the optional statically registered admin plugin renderer selected for this field. The returned configuration is detached from the immutable definition.

func (View) AdminPolicy added in v0.2.0

func (d View) AdminPolicy() Admin

AdminPolicy returns a detached complete presentation policy draft.

func (View) BehaviorSummary added in v0.2.0

func (d View) BehaviorSummary() PolicySummary

BehaviorSummary describes the attached policies without exposing function addresses.

func (View) BlockReferences added in v0.2.0

func (d View) BlockReferences() []string

BlockReferences returns the declared registry slugs, never expanded definitions.

func (View) Blocks added in v0.2.0

func (d View) Blocks() []Block

Blocks returns a deep copy of the allowed block types.

func (View) Boundary added in v0.2.0

func (d View) Boundary() Boundary

Boundary reports a node's value/traversal semantics, not just its broad kind.

func (View) Branches added in v0.2.0

func (d View) Branches() []Branch

Branches exposes only schema-owned children, including published embedded payload cases. Arbitrary plugin JSON is never interpreted as fields.

func (View) Category added in v0.2.0

func (d View) Category() Category

Category returns the behavioral category for the definition's field kind.

func (View) CodeLanguage added in v0.2.0

func (d View) CodeLanguage() string

CodeLanguage is the editor language hint for a code field.

func (View) Columns added in v0.2.0

func (d View) Columns() int

Columns returns the requested one-to-twelve-column admin grid width, or zero.

func (View) DateFormat added in v0.2.0

func (d View) DateFormat() DateFormat

DateFormat returns the accepted date value format, defaulting to DateOnly.

func (View) Default added in v0.2.0

func (d View) Default() (DefaultValue, bool)

Default returns the configured typed literal default. List defaults use canonical JSON arrays. Dynamic defaults are executable policies and are not evaluated by this reader.

func (View) Description added in v0.2.0

func (d View) Description() string

Description returns the configured author-facing supporting text.

func (View) DescriptionTranslations added in v0.2.0

func (d View) DescriptionTranslations() map[string]string

DescriptionTranslations returns localized supporting text by admin language.

func (View) Editor added in v0.2.0

func (d View) Editor() (string, json.RawMessage)

Editor returns a detached application editor selection.

func (View) EmbeddedTrees added in v0.2.0

func (d View) EmbeddedTrees() []EmbeddedTree

EmbeddedTrees returns detached declarative embedded schema definitions.

func (View) Fields added in v0.2.0

func (d View) Fields() Fields

Fields returns a deep copy of the nested child definitions.

func (View) HasBehavior added in v0.2.0

func (d View) HasBehavior() bool

HasBehavior identifies executable policies owned by this field.

func (View) Hidden added in v0.2.0

func (d View) Hidden() bool

Hidden reports whether the admin should omit this field from presentation.

func (View) Index added in v0.2.0

func (d View) Index() bool

Index reports whether the field should have a non-unique database index. Unique fields already receive a unique index even when this is false.

func (View) InitiallyCollapsed added in v0.2.0

func (d View) InitiallyCollapsed() bool

InitiallyCollapsed reports whether a collapsible presentation group starts closed.

func (View) IsNamedTab added in v0.2.0

func (d View) IsNamedTab() bool

IsNamedTab distinguishes a stored object with tab presentation from layout.

func (View) IsUnnamedTab added in v0.2.0

func (d View) IsUnnamedTab() bool

IsUnnamedTab distinguishes a single presentation section from a tab group.

func (View) Issues added in v0.2.0

func (d View) Issues() []Issue

Issues validates the current declaration without executing behavior.

func (View) JoinAllowCreate added in v0.2.0

func (d View) JoinAllowCreate() bool

JoinAllowCreate reports whether the admin may offer inline target creation.

func (View) JoinCollection added in v0.2.0

func (d View) JoinCollection() string

JoinCollection is the collection queried by an inverse join.

func (View) JoinDefaultColumns added in v0.2.0

func (d View) JoinDefaultColumns() []string

JoinDefaultColumns returns the target fields shown by the inverse-join table.

func (View) JoinDefaultSort added in v0.2.0

func (d View) JoinDefaultSort() string

JoinDefaultSort returns the target sort expression, including an optional descending prefix.

func (View) JoinLimit added in v0.2.0

func (d View) JoinLimit() int

JoinLimit is the maximum related documents returned for an inverse join.

func (View) JoinOn added in v0.2.0

func (d View) JoinOn() string

JoinOn is the target relationship path matched against the source document ID.

func (View) Kind added in v0.2.0

func (d View) Kind() Kind

Kind returns the concrete authoring field kind.

func (View) Label added in v0.2.0

func (d View) Label() string

Label returns the explicit author-facing label, if one was configured.

func (View) LabelTranslations added in v0.2.0

func (d View) LabelTranslations() map[string]string

LabelTranslations returns localized author-facing labels by admin language.

func (View) LocalRowLabel added in v0.2.0

func (d View) LocalRowLabel() (string, json.RawMessage)

LocalRowLabel returns a detached application row heading selection.

func (View) Localized added in v0.2.0

func (d View) Localized() bool

Localized reports whether the field stores an independent value for each configured application locale.

func (View) Max added in v0.2.0

func (d View) Max() (float64, bool)

Max returns the inclusive maximum accepted by a number field.

func (View) MaxLength added in v0.2.0

func (d View) MaxLength() (int, bool)

MaxLength returns the maximum accepted Unicode code-point length.

func (View) MaxRows added in v0.2.0

func (d View) MaxRows() int

MaxRows is the maximum accepted length for an array or blocks list, or zero when unbounded.

func (View) Min added in v0.2.0

func (d View) Min() (float64, bool)

Min returns the inclusive minimum accepted by a number field.

func (View) MinLength added in v0.2.0

func (d View) MinLength() (int, bool)

MinLength returns the minimum accepted Unicode code-point length.

func (View) MinRows added in v0.2.0

func (d View) MinRows() int

MinRows is the minimum accepted length for an array or blocks list.

func (View) Name added in v0.2.0

func (d View) Name() string

Name returns the document property name authored for the field.

func (View) Options added in v0.2.0

func (d View) Options() []Option

Options returns a copy of the select options.

func (View) Placeholder added in v0.2.0

func (d View) Placeholder() string

Placeholder returns the canonical empty-state prompt for compatible admin controls.

func (View) PlaceholderTranslations added in v0.2.0

func (d View) PlaceholderTranslations() map[string]string

PlaceholderTranslations returns localized placeholder text by admin language.

func (View) PluginConfig added in v0.2.0

func (d View) PluginConfig() json.RawMessage

PluginConfig returns a copy of the plugin-owned serialized configuration.

func (View) PluginKey added in v0.2.0

func (d View) PluginKey() string

PluginKey returns the compiled plugin responsible for a custom field.

func (View) PluginReferenceKeys added in v0.2.0

func (d View) PluginReferenceKeys() []string

PluginReferenceKeys returns JSON property names whose string values contain public collection slugs and therefore participate in content renames and persisted reference-shape migration safety.

func (View) Private added in v0.2.0

func (d View) Private(namespace string) (store.Value, bool)

Private returns immutable finite owner metadata, never manifest content.

func (View) Provenance added in v0.2.0

func (d View) Provenance() []string

Provenance returns declaration/transform sources for diagnostics.

func (View) ReadOnly added in v0.2.0

func (d View) ReadOnly() bool

ReadOnly reports whether the admin should prevent editing this field.

func (View) ReferenceDeleteAction added in v0.2.0

func (d View) ReferenceDeleteAction() ReferenceDeleteAction

ReferenceDeleteAction returns the explicitly authored hard-delete policy. An empty action means config resolution must apply the deterministic default for the reference shape.

func (View) RelationshipFilters added in v0.2.0

func (d View) RelationshipFilters() []RelationshipFilterRule

RelationshipFilters returns configured multi-rule and polymorphic option filters.

func (View) RelationshipHasMany added in v0.2.0

func (d View) RelationshipHasMany() bool

RelationshipHasMany reports whether the field stores multiple references.

func (View) RelationshipTarget added in v0.2.0

func (d View) RelationshipTarget() string

RelationshipTarget returns the first configured target slug, or an empty string.

func (View) RelationshipTargets added in v0.2.0

func (d View) RelationshipTargets() []string

RelationshipTargets returns a copy of all configured target slugs.

func (View) Required added in v0.2.0

func (d View) Required() bool

Required reports whether validation rejects a missing, null, or field-type-specific empty value.

func (View) RowLabel added in v0.2.0

func (d View) RowLabel() string

RowLabel is the child property used to label array rows in the admin.

func (View) RowLabelComponent added in v0.2.0

func (d View) RowLabelComponent() (pluginKey, component string, config json.RawMessage, ok bool)

RowLabelComponent returns the optional statically registered admin plugin component selected for array or blocks row headings. The returned configuration is detached from the immutable definition.

func (View) RowLabels added in v0.2.0

func (d View) RowLabels() RowLabels

RowLabels returns optional singular and plural author-facing array row names.

func (View) SelectDefaults added in v0.2.0

func (d View) SelectDefaults() []string

SelectDefaults returns the configured literal default options for a multi-select. Dynamic defaults are executable policies and are not evaluated by this reader.

func (View) SelectHasMany added in v0.2.0

func (d View) SelectHasMany() bool

SelectHasMany reports whether a select stores an ordered list of options.

func (View) Sidebar added in v0.2.0

func (d View) Sidebar() bool

Sidebar reports whether a root field belongs in the document editor's right rail.

func (View) SlugSource added in v0.2.0

func (d View) SlugSource() (string, bool)

SlugSource returns the source field path for a text-backed slug helper. The boolean distinguishes an invalid empty source from an ordinary text field.

func (View) Step added in v0.2.0

func (d View) Step() (float64, bool)

Step returns the positive admin input increment for a number field. It is presentation metadata and does not impose divisibility validation.

func (View) Tab added in v0.2.0

func (d View) Tab() string

Tab returns the named admin form tab, or an empty string.

func (View) TabTranslations added in v0.2.0

func (d View) TabTranslations() map[string]string

TabTranslations returns localized direct-tab labels by admin language.

func (View) Unique added in v0.2.0

func (d View) Unique() bool

Unique reports whether values must be distinct within the collection.

func (View) ValueType added in v0.2.0

func (d View) ValueType() ValueType

ValueType is the declared output contract for a virtual field.

type Visit added in v0.2.0

type Visit struct {
	Node     Node
	Branches []BranchSelector
	Index    int
	// Path is the stored schema placement, including block slugs and embedded branches.
	Path []string
	// DefinitionSlug identifies the nearest shared definition, if any.
	DefinitionSlug string
}

Visit carries authored structural breadcrumbs; occurrence binding happens later.

Jump to

Keyboard shortcuts

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