MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / has_triggers

Function has_triggers

nodedb/src/control/trigger/dml_hook.rs:331–345  ·  view source on GitHub ↗

Check if any triggers exist for this collection+event combination. Quick check to avoid fetch_old_row and other overhead when no triggers are defined.

(state: &SharedState, tenant_id: TenantId, collection: &str)

Source from the content-addressed store, hash-verified

329///
330/// Quick check to avoid fetch_old_row and other overhead when no triggers are defined.
331pub fn has_triggers(state: &SharedState, tenant_id: TenantId, collection: &str) -> bool {
332 let tid = tenant_id.as_u64();
333 !state
334 .trigger_registry
335 .get_matching(tid, collection, DmlEvent::Insert)
336 .is_empty()
337 || !state
338 .trigger_registry
339 .get_matching(tid, collection, DmlEvent::Update)
340 .is_empty()
341 || !state
342 .trigger_registry
343 .get_matching(tid, collection, DmlEvent::Delete)
344 .is_empty()
345}

Callers

nothing calls this directly

Calls 3

get_matchingMethod · 0.80
as_u64Method · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected