Module

operation

github.com/riducms/ridu/operation — Read values in field callbacks, report validation errors, and return changes from hooks.

Types 14

  • type operation.Actor

    Actor identifies an authenticated document and its owning auth collection. An empty ID denotes an anonymous actor. Data is an immutable snapshot.

  • type operation.Change

    Change is what a field transform returns: Keep, Set, or Clear. Its zero value means Keep. Clear empties the callback's own logical value; it does not create an external patch command or durable scalar removal representation.

  • type operation.Context

    Context describes one field callback at its current lifecycle phase. Root, Siblings and Prior are detached, immutable snapshots of field values; document metadata such as ID is available separately on Context. A callback changes its own value only through its return value.

  • type operation.ID

    ID is the logical write value of a singular relationship. It is distinct from the potentially populated logical read value.

  • type operation.Issue

    Issue addresses the current field or a descendant relative to its candidate value. A zero Target selects the current field. Ridu supplies resource, field, locale, display-path and stable correlation information; callbacks never construct occurrence IDs.

  • type operation.IssueTarget

    IssueTarget selects the current field or a descendant of its candidate value. It is immutable. Repeated rows use their _key, never their display position. Configuration and runtime identities are supplied by Ridu when validation runs.

  • type operation.IssueTargetSegment

    IssueTargetSegment is one field, repeated row, or exact translation selector. Segments returns detached selectors for inspection; construct targets with At, Field, Row, Block, and Locale.

  • type operation.Kind

    Kind identifies a document operation at resource and field callback boundaries.

  • type operation.LiveValidationContext

    The request and surrounding values available to a live server validation callback.

  • type operation.OccurrenceID

    OccurrenceID is an opaque field-correlation token. A concrete token follows stable row keys across reordering and distinguishes independently localized values. Combine it with the resource and document IDs when correlating work across documents. Application callbacks normally use their value and views instead; do not parse the token or construct one from an array index.

  • type operation.ReferenceOutput

    ReferenceOutput is the logical read value of a singular relationship. ID is available regardless of whether an authorized document was populated.

  • type operation.Value

    Value carries an optional logical value. Its zero value is empty. For raw input, empty means omitted and Present(store.Null()) means explicit null. For typed scalars, empty is the portable empty state, not a durable absence encoding. T must follow its own ownership contract; this carrier does not deep-clone arbitrary mutable application values.

  • type operation.View

    View is an immutable snapshot of one object's field values. Lookup, Get and String accept direct child names, not dotted paths. Follow nested objects with Get("seo").Get("title"); iterate lists with Get("variants").Elements(). These reads share immutable values without copying maps or slices.

  • type operation.WritePhase

    The completeness policy for the current write candidate, independent of whether a public snapshot exists.

Functions 10

  • operation.At()

    At starts a field-relative target. With no arguments it selects the current field. Field paths may contain dots, such as At("seo.title").

  • operation.Clear()

    Clear empties the callback's own value. An optional field becomes null; a required field still fails validation.

  • operation.Empty()

    Empty carries no logical value.

  • operation.Keep()

    Keep leaves the callback's logical value unchanged.

  • operation.ObjectView()

    ObjectView presents an object Value, which is already immutable, without copying it. Any other kind, including the zero Value, is an empty view.

  • operation.Populated()

    Populated snapshots the document and derives the reference ID from it, preventing contradictory caller-supplied ID/document pairs.

  • operation.Present()

    Present carries a logical value, including an explicit zero value.

  • operation.Set()

    Set replaces the callback's own value with value, including a zero value such as "" or false. Ridu validates the result as usual.

  • operation.Snapshot()

    Snapshot detaches the supplied map through store.Object.

  • operation.Unpopulated()

    Unpopulated constructs a reference without populated document output.

Methods 13

Constants 18

Interfaces 1

  • interface operation.Reader

    Reader looks up a known document for a field rule, validator, default or hook. Reads enforce the callback's actor and ordinary authorization, use its exact locale without fallback, and reuse its active transaction. Passing another context can add cancellation but cannot discard the original cancellation or transaction. Use a resource hook and LocalAPI when application work needs nested writes; field callbacks deliberately receive only the read capability they need. During live validation and its authorization checks, reads return stored values without lifecycle hooks, defaults, or computed output.