Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader interface { // Root returns the scheme-specific string representing the root location for this Loader. Root() string // New returns Loader located at newRoot. New(newRoot string) (Loader, error) // Load returns the bytes read from the location or an error. Load(location string) ([]byte, error) }
Loader interface exposes methods to read bytes in a scheme-agnostic manner. The Loader encapsulating a root location to calculate where to read from.
func Init ¶
func Init(schemes []SchemeLoader) Loader
Init initializes the first loader with the supported schemes. Example schemes: fileLoader, httpLoader, gitLoader.
type SchemeLoader ¶
type SchemeLoader interface { // Does this location correspond to this scheme. IsScheme(root string, location string) bool // Combines the root and path into a full location string. FullLocation(root string, path string) (string, error) // Load bytes at scheme-specific location or an error. Load(location string) ([]byte, error) }
Interface for different types of loaders (e.g. fileLoader, httpLoader, etc.)
func NewFileLoader ¶
func NewFileLoader(fs fs.FileSystem) SchemeLoader
NewFileLoader returns a SchemeLoader to handle a file system.
Click to show internal directories.
Click to hide internal directories.