Documentation
¶
Index ¶
- Variables
- func Get(key string) interface{}
- func GetArrayMaps(key string) []map[string]interface{}
- func GetBool(key string) bool
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt64(key string) int64
- func GetString(key string) string
- func LoadConfigFile(name string) error
- func RegisterConfigurator(conf Configurator)
- func ValidateConfiguratorRegister() error
- type Configurator
- type JSONConfigurator
- func (conf JSONConfigurator) Get(key string) interface{}
- func (conf JSONConfigurator) GetArrayMaps(key string) []map[string]interface{}
- func (conf JSONConfigurator) GetBool(key string) bool
- func (conf JSONConfigurator) GetFloat64(key string) float64
- func (conf JSONConfigurator) GetInt(key string) int
- func (conf JSONConfigurator) GetInt64(key string) int64
- func (conf JSONConfigurator) GetString(key string) string
- func (conf JSONConfigurator) Open(name string) error
Constants ¶
This section is empty.
Variables ¶
var FileName string = "config.json"
FileName file name that contain a json object. By default filename: "config.json"
var FilePath string = "./"
FilePath file config path. By default file config path: "./"
Functions ¶
func Get ¶
func Get(key string) interface{}
Get gets a json node from a json key. JSON key example: 'foo.bar'
func GetArrayMaps ¶
GetArrayMaps gets a array json node from a json key. Returns a json array as map. JSON key example: 'foo.bar'
func GetFloat64 ¶
GetFloat64 gets a float 64 json node from a json key. JSON key example: 'foo.bar'
func LoadConfigFile ¶ added in v1.1.0
LoadConfigFile Open file that contins a json object.
func RegisterConfigurator ¶ added in v1.1.0
func RegisterConfigurator(conf Configurator)
RegisterConfigurator a new implement of Configurator interface
func ValidateConfiguratorRegister ¶ added in v1.1.0
func ValidateConfiguratorRegister() error
ValidateConfiguratorRegister validate if the Configurator interfaces has been implement
Types ¶
type Configurator ¶ added in v1.1.0
type Configurator interface { // GetString gets a string json node from a json key. // JSON key example: 'foo.bar' GetString(key string) string // GetInt64 gets an integer 64 json node from a json key. // JSON key example: 'foo.bar' GetInt64(key string) int64 // GetInt gets an integer json node from a json key. // JSON key example: 'foo.bar' GetInt(key string) int // GetFloat64 gets a float 64 json node from a json key. // JSON key example: 'foo.bar' GetFloat64(key string) float64 // GetBool gets a bool json node from a json key. // JSON key example: 'foo.bar' GetBool(key string) bool // Get gets a json node from a json key. // JSON key example: 'foo.bar' Get(key string) interface{} // GetArrayMaps gets a array json node from a json key. Returns // a json array as map. // JSON key example: 'foo.bar' GetArrayMaps(key string) []map[string]interface{} // Open file that contins a json object. Open(name string) error }
Configurator interface provider
type JSONConfigurator ¶ added in v1.1.0
type JSONConfigurator struct{}
JSONConfigurator implement interface provider.
func (JSONConfigurator) Get ¶ added in v1.1.0
func (conf JSONConfigurator) Get(key string) interface{}
Get gets a json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) GetArrayMaps ¶ added in v1.1.0
func (conf JSONConfigurator) GetArrayMaps(key string) []map[string]interface{}
GetArrayMaps gets a array json node from a json key. Returns a json array as map. JSON key example: 'foo.bar'
func (JSONConfigurator) GetBool ¶ added in v1.1.0
func (conf JSONConfigurator) GetBool(key string) bool
GetBool gets a bool json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) GetFloat64 ¶ added in v1.1.0
func (conf JSONConfigurator) GetFloat64(key string) float64
GetFloat64 gets a float 64 json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) GetInt ¶ added in v1.1.0
func (conf JSONConfigurator) GetInt(key string) int
GetInt gets an integer json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) GetInt64 ¶ added in v1.1.0
func (conf JSONConfigurator) GetInt64(key string) int64
GetInt64 gets an integer 64 json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) GetString ¶ added in v1.1.0
func (conf JSONConfigurator) GetString(key string) string
GetString gets a string json node from a json key. JSON key example: 'foo.bar'
func (JSONConfigurator) Open ¶ added in v1.1.0
func (conf JSONConfigurator) Open(name string) error
Open file that contins a json object.