Skip to main content

Module hooks

Module hooks 

Source
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 via Table::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/AfterSave are sugar that register for both insert and update.
HookReturn
What a before_delete hook 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).
BeforeDeleteFn
A before-delete hook: receives the row id and its current contents; may Err to veto, or return HookReturn::Handled to take over (soft-delete).
BeforeFn
A before-write hook: mutate the record in place ahead of invariant enforcement, returning Err to cancel the write. Receives the record being written and the (entity-erased) table for relation/datasource access.