MCPcopy
hub / github.com/pocketbase/pocketbase / LoadFiles

Method LoadFiles

tools/template/registry.go:85–98  ·  view source on GitHub ↗

LoadFiles caches (if not already) the specified filenames set as a single template and returns a ready to use Renderer instance. There must be at least 1 filename specified.

(filenames ...string)

Source from the content-addressed store, hash-verified

83//
84// There must be at least 1 filename specified.
85func (r *Registry) LoadFiles(filenames ...string) *Renderer {
86 key := strings.Join(filenames, ",")
87
88 found := r.cache.Get(key)
89
90 if found == nil {
91 // parse and cache
92 tpl, err := template.New(filepath.Base(filenames[0])).Funcs(r.funcs).ParseFiles(filenames...)
93 found = &Renderer{template: tpl, parseError: err}
94 r.cache.Set(key, found)
95 }
96
97 return found
98}
99
100// LoadString caches (if not already) the specified inline string as a
101// single template and returns a ready to use Renderer instance.

Callers 1

TestRegistryLoadFilesFunction · 0.95

Calls 2

GetMethod · 0.65
SetMethod · 0.65

Tested by 1

TestRegistryLoadFilesFunction · 0.76