Documentation
¶
Index ¶
- Variables
- func Ext(keys string, defVal ...interface{}) interface{}
- func ExtBool(keys string, defVal ...interface{}) bool
- func ExtDuration(keys string, defVal ...interface{}) time.Duration
- func ExtFloat32(keys string, defVal ...interface{}) float32
- func ExtFloat64(keys string, defVal ...interface{}) float64
- func ExtInt(keys string, defVal ...interface{}) int
- func ExtInt16(keys string, defVal ...interface{}) int16
- func ExtInt32(keys string, defVal ...interface{}) int32
- func ExtInt64(keys string, defVal ...interface{}) int64
- func ExtInt8(keys string, defVal ...interface{}) int8
- func ExtString(keys string, defVal ...interface{}) string
- func LoadConf(path string)
- type Config
- func (c *Config) Ext(keys string, defaultVal ...interface{}) interface{}
- func (c *Config) ExtBool(keys string, defaultVal ...interface{}) bool
- func (c *Config) ExtDuration(keys string, defaultVal ...interface{}) time.Duration
- func (c *Config) ExtFloat32(keys string, defaultVal ...interface{}) float32
- func (c *Config) ExtFloat64(keys string, defaultVal ...interface{}) float64
- func (c *Config) ExtInt(keys string, defaultVal ...interface{}) int
- func (c *Config) ExtInt16(keys string, defaultVal ...interface{}) int16
- func (c *Config) ExtInt32(keys string, defaultVal ...interface{}) int32
- func (c *Config) ExtInt64(keys string, defaultVal ...interface{}) int64
- func (c *Config) ExtInt8(keys string, defaultVal ...interface{}) int8
- func (c *Config) ExtSep(keys, sep string) (interface{}, error)
- func (c *Config) ExtString(keys string, defaultVal ...interface{}) string
- type Database
- func (d *Database) Ext(key string, defaultVal ...interface{}) interface{}
- func (d *Database) ExtBool(key string, defaultVal ...interface{}) bool
- func (d *Database) ExtDuration(key string, defaultVal ...interface{}) time.Duration
- func (d *Database) ExtInt(key string, defaultVal ...interface{}) int
- func (d *Database) ExtString(key string, defaultVal ...interface{}) string
- type KafkaConsumer
- type KafkaProducer
- type Log
- type Redis
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Conf = Config{}
)
Functions ¶
func ExtDuration ¶
ExtDuration is a shorcut for (c *Config) ExtDuration()
func ExtFloat32 ¶
ExtFloat32 is a shorcut for (c *Config) ExtFloat32()
func ExtFloat64 ¶
ExtFloat64 is a shorcut for (c *Config) ExtFloat64()
Types ¶
type Config ¶
type Config struct { Log Log `yaml:"log,flow"` Databases []*Database `yaml:"databases,flow"` Redises []*Redis `yaml:"redises,flow"` KafkaProducers []*KafkaProducer `yaml:"kafkaProducers,flow"` KafkaConsumers []*KafkaConsumer `yaml:"kafkaConsumers,flow"` EXT map[string]interface{} `yaml:"ext,flow"` }
func (*Config) Ext ¶
Ext will return the value of the EXT config, the keys is a string separated by DOT(.). If you provide a default value, this method will return the it while the key cannot be found. otherwise it will raise a panic!
func (*Config) ExtDuration ¶
func (*Config) ExtFloat32 ¶
func (*Config) ExtFloat64 ¶
type Database ¶
type Database struct { Key string `yaml:"key"` Type string `yaml:"type"` Host string `yaml:"host"` Name string `yaml:"name"` User string `yaml:"user"` Password string `yaml:"password"` MinPoolSize int `yaml:"minPoolSize"` MaxPoolSize int `yaml:"maxPoolSize"` EXT map[string]interface{} `yaml:",flow"` }
func (*Database) ExtDuration ¶
type KafkaConsumer ¶
type KafkaConsumer struct { Key string `yaml:"key"` Address []string `yaml:"address"` // kafka地址 Group string `yaml:"group"` // groupId Offset int64 `yaml:"offset"` Ack int `yaml:"ack"` // ack类型 DialTimeout time.Duration `yaml:"dialTimeout"` // How long to wait for the initial connection. ReadTimeout time.Duration `yaml:"readTimeout"` // How long to wait for a response. WriteTimeout time.Duration `yaml:"writeTimeout"` // How long to wait for a transmit. KeepAlive time.Duration `yaml:"keepAlive"` //username and password for SASL/PLAIN or SASL/SCRAM authentication User string `yaml:"user"` Password string `yaml:"password"` }
type KafkaProducer ¶
type KafkaProducer struct { Key string `yaml:"key"` Address []string `yaml:"address"` Async bool `yaml:"async"` ReturnSuccess bool `yaml:"returnSuccess"` ReturnError bool `yaml:"returnError"` //username and password for SASL/PLAIN or SASL/SCRAM authentication User string `yaml:"user"` Password string `yaml:"password"` }
Click to show internal directories.
Click to hide internal directories.