mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-09 08:42:49 +01:00
refactor: remove pocketbase (#1138)
This commit is contained in:
17
app/hook/hook.go
Normal file
17
app/hook/hook.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package hook
|
||||
|
||||
import "context"
|
||||
|
||||
type Hook struct {
|
||||
subscribers []func(ctx context.Context, table string, record any)
|
||||
}
|
||||
|
||||
func (h *Hook) Publish(ctx context.Context, table string, record any) {
|
||||
for _, subscriber := range h.subscribers {
|
||||
subscriber(ctx, table, record)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Hook) Subscribe(fn func(ctx context.Context, table string, record any)) {
|
||||
h.subscribers = append(h.subscribers, fn)
|
||||
}
|
||||
Reference in New Issue
Block a user