config

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBool

func ParseBool(val interface{}) (value bool, err error)

func Register

func Register(adapterName string, adapter Config)

Types

type AppConf

type AppConf struct {
	WarmUpData bool
	Mu         sync.Mutex
	Once       sync.Once
}
var AppConfig *AppConf

type Config

type Config interface {
	ParseFile(file string) (Configer, error)
}

type Configer

type Configer interface {
	Set(key, val string) error
	Get(key string) (interface{}, error)
	Int(key string) (int, error)
	Int64(key string) (int64, error)
	Bool(key string) (bool, error)
	String(key string) (string, error)
	Float64(key string) (float64, error)
	RawData() []byte
}

func NewConfig

func NewConfig(adapterName, file string) (Configer, error)

type JsonConfig

type JsonConfig struct{}

func (*JsonConfig) ParseData

func (js *JsonConfig) ParseData(data []byte) (Configer, error)

func (*JsonConfig) ParseFile

func (js *JsonConfig) ParseFile(filename string) (Configer, error)

type JsonConfigContainer

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

func (*JsonConfigContainer) Bool

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

func (*JsonConfigContainer) Float64

func (c *JsonConfigContainer) Float64(key string) (float64, error)

func (*JsonConfigContainer) Get

func (c *JsonConfigContainer) Get(key string) (interface{}, error)

func (*JsonConfigContainer) Int

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

func (*JsonConfigContainer) Int64

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

func (*JsonConfigContainer) RawData

func (c *JsonConfigContainer) RawData() []byte

func (*JsonConfigContainer) Set

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

func (*JsonConfigContainer) String

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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