pub struct AfterMutationTrigger {
pub function_name: String,
pub entity_type: String,
pub event_filter: Option<EventKind>,
}Expand description
Trigger that fires after a mutation completes.
When a mutation completes, the observer pipeline emits an EntityEvent.
If an AfterMutationTrigger matches the entity type and event kind,
the corresponding function is invoked asynchronously without blocking
the mutation response.
§Matching
- Must match
entity_typeexactly - If
event_filterisNone, matches all event kinds (Insert/Update/Delete) - If
event_filterisSome, matches only that specific event kind
§Dispatch
- Invoked in declaration order from
schema.compiled.json - Spawned as an async task (mutation response returns immediately)
- Function execution timeout: 5s default (can be overridden per function)
- Failure doesn’t affect mutation (error logged to tracing subscriber)
Fields§
§function_name: StringName of the function to invoke.
entity_type: StringEntity type to trigger on (e.g., “User”).
event_filter: Option<EventKind>Optional filter on event kind (None = all).
Implementations§
Source§impl AfterMutationTrigger
impl AfterMutationTrigger
Sourcepub fn matches(&self, entity: &str, event_kind: EventKind) -> bool
pub fn matches(&self, entity: &str, event_kind: EventKind) -> bool
Check if this trigger matches the given entity and event.
Sourcepub fn build_payload(&self, event: &EntityEvent) -> EventPayload
pub fn build_payload(&self, event: &EntityEvent) -> EventPayload
Build an EventPayload from an entity event.
Trait Implementations§
Source§impl Clone for AfterMutationTrigger
impl Clone for AfterMutationTrigger
Source§fn clone(&self) -> AfterMutationTrigger
fn clone(&self) -> AfterMutationTrigger
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AfterMutationTrigger
impl RefUnwindSafe for AfterMutationTrigger
impl Send for AfterMutationTrigger
impl Sync for AfterMutationTrigger
impl Unpin for AfterMutationTrigger
impl UnsafeUnpin for AfterMutationTrigger
impl UnwindSafe for AfterMutationTrigger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more