Documentation
¶
Overview ¶
Package event provides the synchronous, in-process event bus used for Document lifecycle hooks (before_save, after_insert, etc.).
See TAD §2.5 and PRD §19.1 for the full specification. Implemented in Phase 4.
Index ¶
Constants ¶
const ( EventBeforeValidate = "before_validate" EventAfterValidate = "after_validate" EventBeforeInsert = "before_insert" EventBeforeSave = "before_save" EventAfterInsert = "after_insert" EventAfterSave = "after_save" EventBeforeUpdate = "before_update" EventAfterUpdate = "after_update" EventBeforeDelete = "before_delete" EventAfterDelete = "after_delete" EventOnSubmit = "on_submit" EventOnCancel = "on_cancel" EventOnWorkflow = "on_workflow_transition" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus interface {
// On registers handler h for (docType, eventName).
// Handlers run in registration order (fail-fast, see Emit).
On(docType, eventName string, h Handler)
// Emit fires all registered handlers for (docType, eventName) in order.
// If any handler returns a non-nil error, Emit stops and returns that error
// immediately — subsequent handlers are not called (PRD §19.2 semantics).
Emit(ctx context.Context, docType, eventName string, doc map[string]any) error
}
Bus is the in-process, synchronous event dispatcher for Document lifecycle events. See TAD §2.5.
Ordering: handlers for a (docType, eventName) pair run strictly in registration order and stop on the first error. The Bus has no notion of Applications, so cross-app ordering on a shared pair is whatever the wiring's registration order makes it. TAD §7.1 step 3's "a dependency's hooks run before its dependent's" is realized by installing Applications in dependency-resolved order (app.ResolveDAG) — each app's hooks are then registered before its dependent's. That is a registration-order guarantee, not one the Bus enforces (REVIEW-2026-08-12 finding 15).