file

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 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 Backend

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

Backend that loads a configuration from a file. It supports json and yaml formats.

func NewBackend

func NewBackend(path string) *Backend

NewBackend creates a configuration loader that loads from a file. The content will get decoded based on the file extension and cached in the backend.

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key string) ([]byte, error)

Get is not implemented.

func (*Backend) Name

func (b *Backend) Name() string

Name returns the type of the file.

func (*Backend) UnmarshalValue

func (b *Backend) UnmarshalValue(ctx context.Context, key string, to interface{}) error

UnmarshalValue unmarshals the given key directly to the given target. It returns an error if the underlying file cannot be loaded.

Jump to

Keyboard shortcuts

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