MCPcopy
hub / github.com/pocketbase/pocketbase / BindFunc

Method BindFunc

tools/hook/tagged.go:76–84  ·  view source on GitHub ↗

BindFunc registers a new handler with the specified function. It is similar to [Hook.Bind] with the difference that the handler function is invoked only if the event data tags satisfy h.CanTriggerOn.

(fn func(e T) error)

Source from the content-addressed store, hash-verified

74// It is similar to [Hook.Bind] with the difference that the handler
75// function is invoked only if the event data tags satisfy h.CanTriggerOn.
76func (h *TaggedHook[T]) BindFunc(fn func(e T) error) string {
77 return h.mainHook.BindFunc(func(e T) error {
78 if h.CanTriggerOn(e.Tags()) {
79 return fn(e)
80 }
81
82 return e.Next()
83 })
84}

Callers

nothing calls this directly

Calls 4

CanTriggerOnMethod · 0.95
TagsMethod · 0.65
NextMethod · 0.65
fnFunction · 0.50

Tested by

no test coverage detected