config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("field not found")

Functions

func GetBool

func GetBool(config map[string]interface{}, field string, opts ...Option) (bool, error)

GetInt gets an int from the given field.

func GetFloat64

func GetFloat64(config map[string]interface{}, field string, opts ...Option) (float64, error)

GetFloat64 gets a float64 from the given field.

func GetIPAddress

func GetIPAddress(config map[string]interface{}, field string, opts ...Option) (string, int, error)

GetIPAddress gets an ip address from the given field.

func GetIPAddressList added in v0.3.0

func GetIPAddressList(config map[string]interface{}, field string, opts ...Option) ([]string, []int, error)

GetIPAddress gets an ip address list, as a list of hosts and a list of ports from the given field.

func GetInt

func GetInt(config map[string]interface{}, field string, opts ...Option) (int, error)

GetInt gets an int from the given field.

func GetInterface

func GetInterface(config map[string]interface{}, field string, opts ...Option) (interface{}, error)

GetInterface get's the given potentially nested field irrelevant of it's type. This will recursively descend into submaps.

func GetInterfaceList

func GetInterfaceList(config map[string]interface{}, field string, opts ...Option) ([]interface{}, error)

GetInterfaceList gets a list from the given field.

func GetMap

func GetMap(config map[string]interface{}, field string, opts ...Option) (map[string]interface{}, error)

GetMap gets a sub-map from the given field.

func GetString

func GetString(config map[string]interface{}, field string, opts ...Option) (string, error)

GetString gets a string from the given field.

func GetStringList

func GetStringList(config map[string]interface{}, field string, opts ...Option) ([]string, error)

GetStringList gets a string list from the given field.

Types

type Config

type Config struct {
	DataSources []DataSourceConfig     `yaml:"dataSources"`
	Execution   map[string]interface{} `yaml:"execution"`
	Physical    map[string]interface{} `yaml:"physical"`
}

func ReadConfig

func ReadConfig(path string) (*Config, error)

func (*Config) GetDataSourceConfig added in v0.1.1

func (config *Config) GetDataSourceConfig(name string) (map[string]interface{}, error)

type DataSourceConfig

type DataSourceConfig struct {
	Name   string                 `yaml:"name"`
	Type   string                 `yaml:"type"`
	Config map[string]interface{} `yaml:"config"`
}

type Option

type Option func(options *options)

func WithDefault

func WithDefault(value interface{}) Option

Jump to

Keyboard shortcuts

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