type
Observer
Observer runs code at a field lifecycle event. It receives the context and the field's value, but cannot return a replacement or mutate the context snapshots. Return nil to continue or an error to stop. Before commit, errors roll back the operation; an AfterCommit error reports failure after data has already saved.
Full signature
type Observer[T any] func(
operation.Context,
operation.Value[T],
) errorRelated types
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.
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.