resource

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSLocator

type FSLocator struct {
	// contains filtered or unexported fields
}

FSLocator is an implementation of ReadLocator that uses the fs.FS abstraction to load resources, allowing the API to be used with embedded files.

func NewFSLocator

func NewFSLocator(filesys fs.FS) *FSLocator

NewFSLocator returns a new instance of *FSLocator that uses the specified fs.FS to access resources.

func (*FSLocator) ReadResource

func (l *FSLocator) ReadResource(path string) (io.ReadCloser, error)

type FileLocator

type FileLocator struct {
	// contains filtered or unexported fields
}

FileLocator is an implementation of ReadLocator and WriteLocator that uses the local filesystem to access resources.

func NewFileLocator

func NewFileLocator(dir string) *FileLocator

NewFileLocator returns a new *FileLocator that is configured to access resources located on the local filesystem.

func (*FileLocator) ReadResource

func (l *FileLocator) ReadResource(path string) (io.ReadCloser, error)

func (*FileLocator) WriteResource

func (l *FileLocator) WriteResource(path string) (io.WriteCloser, error)

type ReadLocator

type ReadLocator interface {

	// ReadResource opens the resource at the specified path for reading.
	ReadResource(path string) (io.ReadCloser, error)
}

ReadLocator represents a logic by which resources can be opened for reading based off of a path.

type WriteLocator

type WriteLocator interface {

	// WriteResource opens the resource at the specified path for writing.
	WriteResource(path string) (io.WriteCloser, error)
}

WriteLocator represents a logic by which resources can be opened for writing based off of a path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL