Skip to main content

Module trigger

Module trigger 

Source
Expand description

Generic trigger handler trait and types for entity lifecycle events.

Deprecated. Nothing calls this registry, and ActionExecutor only logs. Hook triggers: now run in the write’s transaction through crate::write_hooks: the schema generator emits a <Model>WriteHooks that runs a trigger’s compilable actions and a <Model>Triggers trait for the rest. This module stays for one minor release so code that names it still builds, and is removed after it.

Phase 0 generic base for the trigger.rs generator (Category C).

Every generated {Model}TriggerHandler used to re-define the same boilerplate. This module provides the single generic version so that generated files collapse to type aliases:

ⓘ
use backbone_core::trigger::{TriggerEvent, TriggerContext, TriggerContextMut,
                              TriggerRegistry, ActionExecutor, TriggerHandler};
use crate::domain::entity::Order;

pub type OrderTriggerEvent      = TriggerEvent;
pub type OrderTriggerContext    = TriggerContext<Order>;
pub type OrderTriggerContextMut = TriggerContextMut<Order>;
pub type OrderActionExecutor    = ActionExecutor;
pub type OrderTriggerRegistry   = TriggerRegistry<Order>;
pub type OrderTriggerHandlerObj = dyn TriggerHandler<TriggerContext<Order>, TriggerEvent>;

Structs§

ActionExecutorDeprecated
Shared executor for side-effect actions (email, notify, webhook, emit).
TriggerContextDeprecated
Immutable trigger context passed to handlers.
TriggerContextMutDeprecated
Mutable trigger context for before-hooks that may modify the entity.
TriggerRegistryDeprecated
Registry that dispatches trigger events to registered handlers.

Enums§

TriggerEventDeprecated
Lifecycle trigger events — identical for every entity.

Traits§

TriggerHandlerDeprecated
Generic lifecycle trigger handler.