Module
operation
github.com/riducms/ridu/operation — Read values in field callbacks, report validation errors, and return changes from hooks.
Types 19
type operation.AccessContextAccessContext 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.ActorActor identifies an authenticated document and its owning auth collection. An empty ID denotes an anonymous actor. Data is an immutable snapshot.
type operation.ChangeChange 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.ContextContext 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.DefaultContextThe request and surrounding values available to a field’s dynamic default callback.
type operation.EventContextEventContext is the view for field lifecycle observations. Observation callbacks do not return mutations to field or ambient document values.
type operation.IDID is the logical write value of a singular relationship. It is distinct from the potentially populated logical read value.
type operation.IssueIssue 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.IssueTargetIssueTarget 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.IssueTargetSegmentIssueTargetSegment 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.KindKind identifies a document operation at resource and field callback boundaries.
type operation.LiveValidationContextThe request and surrounding values available to a live server validation callback.
type operation.OccurrenceIDOccurrenceID 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.ReadContextReadContext 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.ReferenceOutputReferenceOutput is the logical read value of a singular relationship. ID is available regardless of whether an authorized document was populated.
type operation.ValidationContextValidationContext 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.ValueValue 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.ViewView 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.WriteContextWriteContext 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
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.Empty()Empty carries no logical value.
operation.Keep()Keep leaves the callback's logical value unchanged.
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.Replace()Replace replaces the callback's own logical value.
operation.Snapshot()Snapshot detaches the supplied map through store.Object.
operation.Unpopulated()Unpopulated constructs a reference without populated document output.
Methods 13
Constants 12
constant operation.AdminPublic constant Admin from github.com/riducms/ridu/operation.
constant operation.CreatePublic constant Create from github.com/riducms/ridu/operation.
constant operation.DeletePublic constant Delete from github.com/riducms/ridu/operation.
constant operation.DeletePermanentPublic constant DeletePermanent from github.com/riducms/ridu/operation.
constant operation.DuplicatePublic constant Duplicate from github.com/riducms/ridu/operation.
constant operation.PublishPublic constant Publish from github.com/riducms/ridu/operation.
constant operation.ReadPublic constant Read from github.com/riducms/ridu/operation.
constant operation.ReadVersionsPublic constant ReadVersions from github.com/riducms/ridu/operation.
constant operation.RestoreDeletedPublic constant RestoreDeleted from github.com/riducms/ridu/operation.
constant operation.UnlockPublic constant Unlock from github.com/riducms/ridu/operation.
constant operation.UnpublishPublic constant Unpublish from github.com/riducms/ridu/operation.
constant operation.UpdatePublic constant Update from github.com/riducms/ridu/operation.
Interfaces 1
interface operation.ReaderReader 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.