config

package
v0.0.0-...-8d59c21 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addr

func Addr() string

func IsDev

func IsDev() bool

func IsSingle

func IsSingle() bool

IsSingle 是否单独实例,非集群

func Log

func Log() string

func Mode

func Mode() string

func ReadConfigFile

func ReadConfigFile(configFile string) (bytes []byte, err error)

func Register

func Register(c Config)

func RegisterDefault

func RegisterDefault()

Types

type Config

type Config interface {
	GetDb() DbConfig
	GetAddr() string
	GetEnv() string
	IsDev() bool
	GetMode() string
	GetNode() int
	GetLog() string
	IsSingle() bool
}

type DbConfig

type DbConfig struct {
	Host        string `toml:"host"`
	Port        int    `toml:"port"`
	Username    string `toml:"username"`
	Password    string `toml:"password"`
	Dbname      string `toml:"dbname"`
	Charset     string `toml:"charset"`
	MaxOpenConn int    `toml:"pool_max_open"`
	MaxIdleConn int    `toml:"pool_max_idle"`
	MaxLifetime int    `toml:"pool_max_life"`
}

func Db

func Db() DbConfig

type DefaultConfig

type DefaultConfig struct {
	Addr string   `toml:"addr"`
	Env  string   `toml:"env"`
	Log  string   `toml:"log"`
	Db   DbConfig `toml:"db"`
	Node int      `toml:"node"`
}

func (*DefaultConfig) GetAddr

func (c *DefaultConfig) GetAddr() string

func (*DefaultConfig) GetDb

func (c *DefaultConfig) GetDb() DbConfig

func (*DefaultConfig) GetEnv

func (c *DefaultConfig) GetEnv() string

func (*DefaultConfig) GetLog

func (c *DefaultConfig) GetLog() string

func (*DefaultConfig) GetMode

func (c *DefaultConfig) GetMode() string

func (*DefaultConfig) GetNode

func (c *DefaultConfig) GetNode() int

func (*DefaultConfig) IsDev

func (c *DefaultConfig) IsDev() bool

func (*DefaultConfig) IsSingle

func (c *DefaultConfig) IsSingle() bool

Jump to

Keyboard shortcuts

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