type

Transform

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, Set(value) to change it, or Clear[T]() to empty it. An error stops the operation. Returned values still pass through validation and field access checks.

Full signature

Related types

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

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