beego: github.com/astaxie/beego/core/config/json Index | Files

package json

import "github.com/astaxie/beego/core/config/json"

Index

Package Files

json.go

type JSONConfig Uses

type JSONConfig struct {
}

JSONConfig is a json config parser and implements Config interface.

func (*JSONConfig) Parse Uses

func (js *JSONConfig) Parse(filename string) (config.Configer, error)

Parse returns a ConfigContainer with parsed json config map.

func (*JSONConfig) ParseData Uses

func (js *JSONConfig) ParseData(data []byte) (config.Configer, error)

ParseData returns a ConfigContainer with json string

type JSONConfigContainer Uses

type JSONConfigContainer struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

JSONConfigContainer is a config which represents the json configuration. Only when get value, support key as section:name type.

func (*JSONConfigContainer) Bool Uses

func (c *JSONConfigContainer) Bool(key string) (bool, error)

Bool returns the boolean value for a given key.

func (*JSONConfigContainer) DIY Uses

func (c *JSONConfigContainer) DIY(key string) (v interface{}, err error)

DIY returns the raw value by a given key.

func (*JSONConfigContainer) DefaultBool Uses

func (c *JSONConfigContainer) DefaultBool(key string, defaultVal bool) bool

DefaultBool return the bool value if has no error otherwise return the defaultval

func (*JSONConfigContainer) DefaultFloat Uses

func (c *JSONConfigContainer) DefaultFloat(key string, defaultVal float64) float64

DefaultFloat returns the float64 value for a given key. if err != nil return defaultval

func (*JSONConfigContainer) DefaultInt Uses

func (c *JSONConfigContainer) DefaultInt(key string, defaultVal int) int

DefaultInt returns the integer value for a given key. if err != nil return defaultval

func (*JSONConfigContainer) DefaultInt64 Uses

func (c *JSONConfigContainer) DefaultInt64(key string, defaultVal int64) int64

DefaultInt64 returns the int64 value for a given key. if err != nil return defaultval

func (*JSONConfigContainer) DefaultString Uses

func (c *JSONConfigContainer) DefaultString(key string, defaultVal string) string

DefaultString returns the string value for a given key. if err != nil return defaultval

func (*JSONConfigContainer) DefaultStrings Uses

func (c *JSONConfigContainer) DefaultStrings(key string, defaultVal []string) []string

DefaultStrings returns the []string value for a given key. if err != nil return defaultval

func (*JSONConfigContainer) Float Uses

func (c *JSONConfigContainer) Float(key string) (float64, error)

Float returns the float value for a given key.

func (*JSONConfigContainer) GetSection Uses

func (c *JSONConfigContainer) GetSection(section string) (map[string]string, error)

GetSection returns map for the given section

func (*JSONConfigContainer) Int Uses

func (c *JSONConfigContainer) Int(key string) (int, error)

Int returns the integer value for a given key.

func (*JSONConfigContainer) Int64 Uses

func (c *JSONConfigContainer) Int64(key string) (int64, error)

Int64 returns the int64 value for a given key.

func (*JSONConfigContainer) OnChange Uses

func (c *JSONConfigContainer) OnChange(key string, fn func(value string))

func (*JSONConfigContainer) SaveConfigFile Uses

func (c *JSONConfigContainer) SaveConfigFile(filename string) (err error)

SaveConfigFile save the config into file

func (*JSONConfigContainer) Set Uses

func (c *JSONConfigContainer) Set(key, val string) error

Set writes a new value for key.

func (*JSONConfigContainer) String Uses

func (c *JSONConfigContainer) String(key string) (string, error)

String returns the string value for a given key.

func (*JSONConfigContainer) Strings Uses

func (c *JSONConfigContainer) Strings(key string) ([]string, error)

Strings returns the []string value for a given key.

func (*JSONConfigContainer) Sub Uses

func (c *JSONConfigContainer) Sub(key string) (config.Configer, error)

func (*JSONConfigContainer) Unmarshaler Uses

func (c *JSONConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...config.DecodeOption) error

Package json imports 11 packages (graph) and is imported by 1 packages. Updated 2020-11-07. Refresh now. Tools for package owners.