octosql: github.com/cube2222/octosql/config Index | Files

package config

import "github.com/cube2222/octosql/config"

Index

Package Files

config.go getters.go

Variables

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

func GetBool Uses

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

GetInt gets an int from the given field.

func GetFloat64 Uses

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

GetFloat64 gets a float64 from the given field.

func GetIPAddress Uses

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

GetIPAddress gets an ip address from the given field.

func GetIPAddressList Uses

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 Uses

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

GetInt gets an int from the given field.

func GetInterface Uses

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 Uses

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

GetInterfaceList gets a list from the given field.

func GetMap Uses

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 Uses

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

GetString gets a string from the given field.

func GetStringList Uses

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

GetStringList gets a string list from the given field.

type Config Uses

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

func ReadConfig Uses

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

func (*Config) GetDataSourceConfig Uses

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

type DataSourceConfig Uses

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

type Option Uses

type Option func(options *options)

func WithDefault Uses

func WithDefault(value interface{}) Option

Package config imports 7 packages (graph) and is imported by 19 packages. Updated 2020-05-14. Refresh now. Tools for package owners.