MCPcopy
hub / github.com/pocketbase/pocketbase / LoadString

Method LoadString

tools/template/registry.go:102–113  ·  view source on GitHub ↗

LoadString caches (if not already) the specified inline string as a single template and returns a ready to use Renderer instance.

(text string)

Source from the content-addressed store, hash-verified

100// LoadString caches (if not already) the specified inline string as a
101// single template and returns a ready to use Renderer instance.
102func (r *Registry) LoadString(text string) *Renderer {
103 found := r.cache.Get(text)
104
105 if found == nil {
106 // parse and cache (using the text as key)
107 tpl, err := template.New("").Funcs(r.funcs).Parse(text)
108 found = &Renderer{template: tpl, parseError: err}
109 r.cache.Set(text, found)
110 }
111
112 return found
113}
114
115// LoadFS caches (if not already) the specified fs and globPatterns
116// pair as single template and returns a ready to use Renderer instance.

Callers 2

TestRegistryAddFuncsFunction · 0.95
TestRegistryLoadStringFunction · 0.95

Calls 3

ParseMethod · 0.80
GetMethod · 0.65
SetMethod · 0.65

Tested by 2

TestRegistryAddFuncsFunction · 0.76
TestRegistryLoadStringFunction · 0.76