config

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func NewConfigWithFile

func NewConfigWithFile(path string) *Config

func NewConfigWithString

func NewConfigWithString(data string) *Config

func (*Config) GetBool

func (c *Config) GetBool(key string, opts ...bool) bool

func (*Config) GetFloat

func (c *Config) GetFloat(key string, opts ...float64) float64

func (*Config) GetInt

func (c *Config) GetInt(key string, opts ...int) int

func (*Config) GetIntArray

func (c *Config) GetIntArray(key string) []int

func (*Config) GetMapConfig

func (c *Config) GetMapConfig(key string) map[string]Config

For config as below: keys:

key1:
    value: xxxxxx
key2:
    value: xxxxxx

we start with the parent key "keys", and locate the subkey "key1" "key2"..., then concatenate to uset the fullpath to get the sub config

func (*Config) GetMapFromArray

func (c *Config) GetMapFromArray(key string) map[string]interface{}

For config as below: keys:

  • key1: value: xxxxxx
  • key2: value: xxxxxx

we start with the parent key "keys", and locate the subkey "key1" "key2"..., then concatenate to uset the fullpath to get the sub config

func (*Config) GetString

func (c *Config) GetString(key string, opts ...string) string

func (*Config) GetStringArray

func (c *Config) GetStringArray(key string) []string

func (*Config) GetSubConfig

func (c *Config) GetSubConfig(key string) *Config

func (*Config) GetValue

func (c *Config) GetValue(key string, target interface{}) error

Jump to

Keyboard shortcuts

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