type

OutputTransform

Change one field in the response without changing storage.

Arguments

ArgumentTypeDescription
ctxoperation.ReadContextThe operation, user, surrounding field values, and access-checked reader for this phase.
valueoperation.Value[T]The value prepared for this response. T can differ from the write type when a relationship is populated.

Returns

Return Keep[T]() to preserve the output or Replace(...) to change this field. An error stops the response and can roll back an uncommitted write.

(operation.Change[T], error)

How it works

Register in ReadHooks.AfterRead. Field read access still applies afterward; access to a context value does not authorize exposing it.

Full signature

Related types

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

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

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

Related guides