Feat triggers v0.2.2 (#6)
All checks were successful
CI/CD / detect-changes (push) Successful in 5s
CI/CD / test-frontend (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m18s
CI/CD / test-sqlite (push) Successful in 2m37s
CI/CD / build-and-deploy (push) Successful in 1m26s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
2026-03-26 22:47:31 +00:00
committed by xcaliber
parent 342f9e3eb4
commit 57ccf19efb
29 changed files with 3237 additions and 3 deletions

25
server/triggers/global.go Normal file
View File

@@ -0,0 +1,25 @@
package triggers
import "sync"
// globalEngine holds a reference to the active trigger engine.
// Set by SetGlobalEngine at startup, used by handlers that need
// to wire triggers immediately on package install.
var (
globalMu sync.RWMutex
globalEngine *Engine
)
// SetGlobalEngine stores the engine reference for use by handlers.
func SetGlobalEngine(e *Engine) {
globalMu.Lock()
globalEngine = e
globalMu.Unlock()
}
// GlobalEngine returns the current engine, or nil.
func GlobalEngine() *Engine {
globalMu.RLock()
defer globalMu.RUnlock()
return globalEngine
}