MCPcopy
hub / github.com/pocketbase/pocketbase / NewRegistry

Function NewRegistry

tools/template/registry.go:38–47  ·  view source on GitHub ↗

NewRegistry creates and initializes a new templates registry with some defaults (eg. global "raw" template function for unescaped HTML). Use the Registry.Load* methods to load templates into the registry.

()

Source from the content-addressed store, hash-verified

36//
37// Use the Registry.Load* methods to load templates into the registry.
38func NewRegistry() *Registry {
39 return &Registry{
40 cache: store.New[string, *Renderer](nil),
41 funcs: template.FuncMap{
42 "raw": func(str string) template.HTML {
43 return template.HTML(str)
44 },
45 },
46 }
47}
48
49// Registry defines a templates registry that is safe to be used by multiple goroutines.
50//

Callers 7

registerMigrationsMethod · 0.92
registerHooksMethod · 0.92
TestNewRegistryFunction · 0.85
TestRegistryAddFuncsFunction · 0.85
TestRegistryLoadFilesFunction · 0.85
TestRegistryLoadStringFunction · 0.85
TestRegistryLoadFSFunction · 0.85

Calls 1

HTMLMethod · 0.80

Tested by 5

TestNewRegistryFunction · 0.68
TestRegistryAddFuncsFunction · 0.68
TestRegistryLoadFilesFunction · 0.68
TestRegistryLoadStringFunction · 0.68
TestRegistryLoadFSFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…