quick

package
v0.0.0-...-6b3dfbf Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDuplicateKeys

func CheckDuplicateKeys(json string) error

CheckDuplicateKeys - checks for duplicate entries in a JSON file

func FormatJSONSyntaxError

func FormatJSONSyntaxError(data io.Reader, offset int64) (highlight string)

FormatJSONSyntaxError generates a pretty printed json syntax error since golang doesn't provide an easy way to report the location of the error

func GetVersion

func GetVersion(filename string, clnt etcd.Client) (version string, err error)

GetVersion - extracts the version information.

func SaveConfig

func SaveConfig(data interface{}, filename string, clnt etcd.Client) (err error)

SaveConfig - saves given configuration data into given file as JSON.

Types

type Config

type Config interface {
	String() string
	Version() string
	Save(string) error
	Load(string) error
	Data() interface{}
	Diff(Config) ([]structs.Field, error)
	DeepDiff(Config) ([]structs.Field, error)
}

Config - generic config interface functions

func LoadConfig

func LoadConfig(filename string, clnt etcd.Client, data interface{}) (qc Config, err error)

LoadConfig - loads json config from filename for the a given struct data

func NewConfig

func NewConfig(data interface{}, clnt etcd.Client) (cfg Config, err error)

NewConfig loads config from etcd client if provided, otherwise loads from a local filename. fails when all else fails.

type ConfigEncoding

type ConfigEncoding interface {
	Unmarshal([]byte, interface{}) error
	Marshal(interface{}) ([]byte, error)
}

ConfigEncoding is a generic interface which marshal/unmarshal configuration.

Jump to

Keyboard shortcuts

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