The standard way to modify the default PocketBase behavior is through
event hooks in your Go code.
Each event hook has 3 public methods:
PreAdd(fn)
- prepend a new listener callback function to the specified event hook.
Returning an error orhook.StopPropagation
in the callback function stops the listeners execution chain.Add(fn)
- append a new listener callback function to the specified event hook.
Returning an error orhook.StopPropagation
in the callback function stops the listeners execution chain.Trigger(data)
- triggers the event hook, aka. executes its listeners in the order they were added.
This method usually is not called manually by users.
Some event hooks, like the DB and Record API hooks, are "proxy" hooks and support an optional tags filter list. If the tags list (eg. collection ids/names) is specified, then all event handlers registered via the proxy hook will be triggered and called only if their event data origin matches the tag(s).
You can explore all available event hooks below: