view

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverUnavailable = errors.New("driver unavailable")

ErrDriverUnavailable indicates that a given driver has not been registered, but was needed to complete some operation.

Functions

func DriverAvailable

func DriverAvailable(name string) bool

DriverAvailable returns true if the given driver has been registered.

func DriverRegister

func DriverRegister(name string, d Driver)

DriverRegister registers a Driver with the package. A Driver must be registered before it can be used.

Types

type Cache

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

A Cache provides a common view cache type for driver implementations. It is safe to share between goroutines.

func DriverInit

func DriverInit(driverName, root string) (*Cache, error)

func (*Cache) Get

func (c *Cache) Get(name string) View

Get retrieves the View stored under the given name, or returns the None no-op View. The returned view will always be non-nil.

func (*Cache) Put

func (c *Cache) Put(name string, view View)

Put stores the View under the given name

type Driver

type Driver interface {
	Init(root string) (*Cache, error)
}

A Driver can initialize a Cache from a directory structure

type View

type View interface {
	Execute(out io.Writer, data interface{}) error
}
var None View = noView{}

None is a no-op View

Jump to

Keyboard shortcuts

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