prefer

package module
v0.0.0-...-3a0c015 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 9 Imported by: 2

README

prefer.go

CircleCI codecov

Powerful configuration management in Go

Documentation

Overview

+build !windows

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStandardPaths

func GetStandardPaths() []string

func Watch

func Watch(identifier string, dest interface{}) (chan interface{}, error)

Types

type Configuration

type Configuration struct {
	Identifier string

	Loaders     map[Loader]filterable
	Serializers map[Serializer]SerializerFactory
}

func Load

func Load(identifier string, dest interface{}) (*Configuration, error)

func NewConfiguration

func NewConfiguration(identifier string) *Configuration

func (*Configuration) Reload

func (this *Configuration) Reload(dest interface{}) error

func (*Configuration) Watch

func (this *Configuration) Watch(dest interface{}, channel chan interface{}) error

type FileLoader

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

func (FileLoader) Load

func (this FileLoader) Load() (string, []byte, error)

func (FileLoader) Locate

func (this FileLoader) Locate() (string, error)

func (FileLoader) Watch

func (this FileLoader) Watch(channel chan bool) error

type Loader

type Loader interface {
	Load() (string, []byte, error)
	Watch(channel chan bool) error
}

func NewLoader

func NewLoader(identifier string) (Loader, error)

type Serializer

type Serializer interface {
	Serialize(interface{}) ([]byte, error)
	Deserialize([]byte, interface{}) error
}

NOTE: It may make more sense to use a map to these instead of creating potentially unnecessray structs for implementing interfaces on.

func NewSerializer

func NewSerializer(identifier string, content []byte) (serializer Serializer, err error)

func NewXMLSerializer

func NewXMLSerializer() Serializer

func NewYAMLSerializer

func NewYAMLSerializer() Serializer

type SerializerFactory

type SerializerFactory func() Serializer

type XMLSerializer

type XMLSerializer struct{}

func (XMLSerializer) Deserialize

func (this XMLSerializer) Deserialize(input []byte, obj interface{}) error

func (XMLSerializer) Serialize

func (this XMLSerializer) Serialize(input interface{}) ([]byte, error)

type YAMLSerializer

type YAMLSerializer struct{}

func (YAMLSerializer) Deserialize

func (this YAMLSerializer) Deserialize(input []byte, obj interface{}) error

func (YAMLSerializer) Serialize

func (this YAMLSerializer) Serialize(input interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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