jconfig

package
v4.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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