resolvers

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileResolver

type FileResolver interface {
	// Read the location of the given file and return it's
	// contents or an error.
	Read(string) ([]byte, error)
	// Resolve the location of the given file
	Resolve(string) (string, error)
}

FileResolver interface to try and resolve the location of a given file.

type GoPathResolver

type GoPathResolver struct {
	Path string
	*RecursiveResolver
}

GoPathResolver will search your entire $GOPATH to find the file in question. I wouldn't really recommend using this approach. It's very very slow the first you try to find a file, and there is no guarantees of finding the right now.

func (*GoPathResolver) Read

func (g *GoPathResolver) Read(name string) ([]byte, error)

Read will search your entire $GOPATH to find the file in question. I wouldn't really recommend using this approach. It's very very slow the first you try to find a file, and there is no guarantees of finding the right now.

func (*GoPathResolver) Resolve

func (g *GoPathResolver) Resolve(name string) (string, error)

Resolve will search your entire $GOPATH to find the file in question. I wouldn't really recommend using this approach. It's very very slow the first you try to find a file, and there is no guarantees of finding the right now.

type RecursiveResolver

type RecursiveResolver struct {
	Path string
	// contains filtered or unexported fields
}

RecursiveResolver will walk the tree of the specified RootPath to resolve the given file name to the a path on disk. It is recommended to scope this as tight as possible as it is possibly quite slow the first time a file is requested. Once a file is found it's resolved path is cached to prevent further slow resolutions.

func (*RecursiveResolver) Read

func (r *RecursiveResolver) Read(name string) ([]byte, error)

Read will walk the tree of the specified RootPath to resolve the given file name to the a path on disk. It is recommended to scope this as tight as possible as it is possibly quite slow the first time a file is requested. Once a file is found it's resolved path is cached to prevent further slow resolutions.

func (*RecursiveResolver) Resolve

func (r *RecursiveResolver) Resolve(name string) (string, error)

Resolve will walk the tree of the specified RootPath to resolve the given file name to the a path on disk. It is recommended to scope this as tight as possible as it is possibly quite slow the first time a file is requested. Once a file is found it's resolved path is cached to prevent further slow resolutions.

type RiceBox

type RiceBox struct {
	Box *rice.Box
}

RiceBox uses the go.rice package to resolve files

func (*RiceBox) Read

func (r *RiceBox) Read(name string) ([]byte, error)

Read data from the rice.Box

func (*RiceBox) Resolve

func (r *RiceBox) Resolve(name string) (string, error)

Resolve the file from the rice.Box

type SimpleResolver

type SimpleResolver struct{}

SimpleResolver is dumb and will just look for the file exactly where you ask for it.

func (*SimpleResolver) Read

func (s *SimpleResolver) Read(name string) ([]byte, error)

Read is dumb and will just look for the file exactly where you ask for it.

func (*SimpleResolver) Resolve

func (s *SimpleResolver) Resolve(name string) (string, error)

Resolve is dumb and will just look for the file exactly where you ask for it.

Jump to

Keyboard shortcuts

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