MCPcopy Create free account
hub / github.com/CloudyKit/jet / Loader

Interface Loader

loader.go:44–52  ·  view source on GitHub ↗

Loader is a minimal interface required for loading templates. Jet will build an absolute path (with slash delimiters) before looking up templates by resolving paths in extends/import/include statements: - `{{ extends "/bar.jet" }}` will make Jet look up `/bar.jet` in the Loader unchanged, no matte

Source from the content-addressed store, hash-verified

42// `/bar.html.jet` and `/bar.jet.html` (in that order). To avoid unneccessary lookups, use the full file name in your templates (so the first lookup
43// is always a hit, or override this list of extensions using Set.SetExtensions().
44type Loader interface {
45 // Exists returns whether or not a template exists under the requested path.
46 Exists(templatePath string) bool
47
48 // Open returns the template's contents or an error if something went wrong.
49 // Calls to Open() will always be preceded by a call to Exists() with the same `templatePath`.
50 // It is the caller's duty to close the template.
51 Open(templatePath string) (io.ReadCloser, error)
52}
53
54// OSFileSystemLoader implements Loader interface using OS file system (os.File).
55type OSFileSystemLoader struct {

Callers 9

TestZeroLoadersFunction · 0.95
getTemplateFromLoaderMethod · 0.65
ExistsMethod · 0.65
TestZeroLoadersFunction · 0.95
loadFromFileMethod · 0.65
OpenMethod · 0.65
OpenMethod · 0.65
OpenMethod · 0.65
OpenMethod · 0.65

Implementers 5

InMemLoaderloader.go
Multiloaders/multi/multi.go
httpFileSystemLoaderloaders/httpfs/loader.go
embedFileSystemLoaderloaders/embedfs/loader.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…