Module

operation

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

Types 19

  • type operation.AccessContext

    AccessContext supplies surrounding values to a field's boolean access rule. Write admission uses the candidate at its authorization checkpoint; read rules inspect the current response and decide whether this field may remain visible.

  • 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 an explicit keep-or-replace result. Its zero value means keep. Replacing with Empty clears 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.DefaultContext

    The request and surrounding values available to a field’s dynamic default callback.

  • type operation.EventContext

    EventContext is the view for field lifecycle observations. Observation callbacks do not return mutations to field or ambient document values.

  • 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.ReadContext

    ReadContext supplies the current response view. References may be populated, so the callback's logical read type can differ from its write type. Ordinary read views may contain locale fallback values; Context has no fallback-source map. Final field redaction still applies after response transforms.

  • 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.ValidationContext

    ValidationContext supplies the completed candidate to a field validator. The separate Value argument is this field's typed current value; Root and Siblings include retained update values and earlier write transformations. Prior remains the persisted enclosing object or row from before the operation. Opt-in advisory checks instead receive LiveValidationContext, whose input has not passed through defaults or save transformations.

  • 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.WriteContext

    WriteContext supplies snapshots to raw and typed field transforms. Raw hooks see input at their phase and may receive omitted or malformed values. Typed write hooks see a completed candidate and their field's logical value.

Functions 8

Methods 13

Constants 12

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.