diff --git a/expr/builtins/builtins.go b/expr/builtins/builtins.go index c85bb0a..c4acde6 100644 --- a/expr/builtins/builtins.go +++ b/expr/builtins/builtins.go @@ -141,6 +141,12 @@ func LoadAllBuiltins() { }) } +// GetFunc gets a function from the global registry if it exists. +func GetFunc(name string) (expr.Func, bool) { + LoadAllBuiltins() // This is behind a sync.Once + return expr.FuncGet(name) +} + // uuid generates a new uuid // // uuid() => "...." diff --git a/expr/funcs.go b/expr/funcs.go index 5102b4f..77f589b 100644 --- a/expr/funcs.go +++ b/expr/funcs.go @@ -84,3 +84,8 @@ func (m *FuncRegistry) FuncGet(name string) (Func, bool) { func FuncAdd(name string, fn CustomFunc) { funcReg.Add(name, fn) } + +// FuncGet gets a function from the global registry if it exists. +func FuncGet(name string) (Func, bool) { + return funcReg.FuncGet(name) +}