file

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 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.

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) Unmarshal added in v0.5.0

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

Unmarshal takes a struct pointer and unmarshals the file into it, using either json or yaml based on the file extention.

Jump to

Keyboard shortcuts

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