type
DefaultFunc
DefaultFunc supplies a server-side initial value for an eligible omitted field. Root and Siblings are snapshots at initialization; Prior is the persisted enclosing object or stable row (empty for new rows). ID may be empty. Locale is exact and Local retains authorization, cancellation and the active transaction. Present supplies a value, including zero values; Empty leaves it without a default. An error stops the operation. Returned values still pass validation. Defaults do not prefill an unsaved admin form and do not run on ordinary edits to an existing scope. Callbacks must not depend on other dynamic defaults or perform irreversible side effects: separate requests or retries can run again.
Full signature
type DefaultFunc[T any] func(operation.Context) (operation.Value[T], error)Related 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.