Expand description
Lifecycle hooks attached to a Table.
Register them with Table::with_hook / Table::add_hook. Before-write
hooks run ahead of set-invariant enforcement, ordered by Phase; the
firing itself lives in the table::sets write paths.
Structs§
- Hooks
- A table’s registered lifecycle hooks, split by placement. The before-write
bands are kept ordered by
Phase. Populated viaTable::with_hook.
Enums§
- Hook
- A lifecycle hook attached to a table via
Table::with_hook. Each variant carries a closure receiving exactly the references available at that stage.BeforeSave/AfterSaveare sugar that register for both insert and update. - Hook
Return - What a
before_deletehook decided. - Phase
- Ordering band for before-write hooks. Hooks run in this order (and in registration order within a band), ahead of set-invariant enforcement.
Type Aliases§
- AfterFn
- An after-commit hook: side-effects on the committed row (id + record). Used for inserts, updates, and deletes (where the record is the former contents).
- Before
Delete Fn - A before-delete hook: receives the row id and its current contents; may
Errto veto, or returnHookReturn::Handledto take over (soft-delete). - Before
Fn - A before-write hook: mutate the record in place ahead of invariant
enforcement, returning
Errto cancel the write. Receives the record being written and the (entity-erased) table for relation/datasource access.