jconfig

package
v4.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Int64Type represents int64 type
	Int64Type = "int64"
	// StringType represents string type
	StringType = "string"
	// BoolType represents bool type
	BoolType = "bool"
)

Variables

This section is empty.

Functions

func GetValueFromMapByType

func GetValueFromMapByType(optionMap map[string]interface{}, key string, valueType string) (value interface{}, err error)

GetValueFromMapByType returns value of given key in the map with given valueType

Types

type Config

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

Config contains a map loaded from t a json file

func NewConfig

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

NewConfig loads the JSON in the file referred to in the path

func (*Config) GetBool

func (c *Config) GetBool(key string) (b bool, err error)

GetBool returns the value in the JSON cast to bool

func (*Config) GetInt64

func (c *Config) GetInt64(key string) (i int64)

GetInt64 returns the value in the JSON cast to int64 (backward compatibility)

func (*Config) GetInt64SliceWithError

func (c *Config) GetInt64SliceWithError(key string) (i int64, err error)

GetInt64SliceWithError returns the value in the JSON cast to int64

func (*Config) GetMap

func (c *Config) GetMap(key string) (keyMap map[string]interface{}, err error)

GetMap returns map of string and interface with error

func (*Config) GetMapSlice

func (c *Config) GetMapSlice(key string) (maps []map[string]interface{}, err error)

GetMapSlice returns map of strings and interface with error

func (*Config) GetString

func (c *Config) GetString(key string) (s string)

GetString returns the string value loaded from the JSON (backward compatibility)

func (*Config) GetStringSlice

func (c *Config) GetStringSlice(key string) (strings []string)

GetStringSlice returns the string value loaded from the JSON (backward compatibility)

func (*Config) GetStringSliceWithError

func (c *Config) GetStringSliceWithError(key string) (strings []string, err error)

GetStringSliceWithError returns the string value loaded from the JSON

func (*Config) GetStringWithError

func (c *Config) GetStringWithError(key string) (s string, err error)

GetStringWithError returns the string value loaded from the JSON

Jump to

Keyboard shortcuts

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