Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { System *System `mapstructure:"system" json:"system" yaml:"system"` Server *Server `mapstructure:"server" json:"server" yaml:"server"` Pgsql *Pgsql `mapstructure:"pgsql" json:"pgsql" yaml:"pgsql"` Mysql *Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"` Sqlite *Sqlite `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"` Logging *Logging `mapstructure:"logging" json:"logging" yaml:"logging"` Redis *Redis `mapstructure:"redis" json:"redis" yaml:"redis"` Etcd *Etcd `mapstructure:"etcd" json:"etcd" yaml:"etcd"` //Rpc *Rpc `mapstructure:"rpc" json:"rpc" yaml:"rpc"` Rocketmq *Rocketmq `mapstructure:"rocketmq" json:"rocketmq" yaml:"rocketmq"` }
type Datasource ¶
type Datasource struct { Host string `mapstructure:"host" default:"" yaml:"host" json:"host"` Port string `mapstructure:"port" default:"" yaml:"port" json:"port"` DbName string `mapstructure:"db-name" default:"" yaml:"db-name" json:"dbName"` Username string `mapstructure:"username" default:"" yaml:"username" json:"username"` Password string `mapstructure:"password" default:"" yaml:"password" json:"password"` Config string `mapstructure:"config" default:"" yaml:"config" json:"config"` Prefix string `mapstructure:"prefix" default:"" yaml:"prefix" json:"prefix"` Engine string `mapstructure:"engine" json:"engine" yaml:"engine" default:"InnoDB"` // 数据库引擎,默认InnoDB Singular bool `mapstructure:"singular" default:"true" yaml:"singular" json:"singular"` MaxIdleConns int `mapstructure:"max-idle-conns" default:"10" yaml:"max-idle-conns" json:"maxIdleConns"` MaxOpenConns int `mapstructure:"max-open-conns" default:"100" yaml:"max-open-conns" json:"maxOpenConns"` MaxLifeTime int `mapstructure:"max-life-time" default:"5" yaml:"max-life-time" json:"maxLifeTime"` LogMode string `mapstructure:"log-mode" default:"debug" yaml:"log-mode" json:"logMode"` LogZap bool `mapstructure:"log-zap" default:"false" yaml:"log-zap" json:"logZap"` }
type Etcd ¶
type Etcd struct { Nodes []string `mapstructure:"nodes" default:"" yaml:"nodes" json:"nodes"` Username string `mapstructure:"username" default:"" yaml:"username" json:"username"` Password string `mapstructure:"password" default:"" yaml:"password" json:"password"` Timeout int `mapstructure:"timeout" default:"10" yaml:"timeout" json:"timeout"` TTl int64 `mapstructure:"ttl" default:"10" yaml:"ttl" json:"ttl"` }
type Logging ¶
type Logging struct { LevelConsole string `mapstructure:"level-console" default:"debug" yaml:"level-console" json:"level-console"` LevelFile string `mapstructure:"level-file" default:"info" yaml:"level-file" json:"level-file"` Prefix string `mapstructure:"prefix" default:"" yaml:"prefix" json:"prefix"` Path string `mapstructure:"path" default:"" yaml:"path" json:"path"` MaxHistory time.Duration `mapstructure:"max-history" default:"7" yaml:"max-history" json:"maxHistory"` LogInConsole bool `mapstructure:"log-in-console" default:"true" yaml:"log-in-console" json:"logInConsole"` LogInFile bool `mapstructure:"log-in-file" default:"false" yaml:"log-in-file" json:"logInFile"` ShowLine bool `mapstructure:"show-line" default:"false" yaml:"show-line" json:"show-line"` }
type Mysql ¶
type Mysql struct {
Datasource `yaml:",inline" mapstructure:",squash"`
}
func (*Mysql) GetLogMode ¶
type Pgsql ¶
type Pgsql struct {
Datasource `yaml:",inline" mapstructure:",squash"`
}
func (*Pgsql) GetLogMode ¶
type Redis ¶
type Redis struct { Addr string `mapstructure:"addr" default:"" yaml:"addr" json:"addr"` // Redis 服务器的地址 Password string `mapstructure:"password" default:"" yaml:"password" json:"password"` // Redis 服务器的密码 DB int `mapstructure:"db" default:"" yaml:"db" json:"db"` // Redis 服务器的数据库编号 MaxRetries int `mapstructure:"max-retries" default:"3" yaml:"max-retries" json:"max-retries"` // Redis 客户端重试连接的最大次数 DialTimeout time.Duration `mapstructure:"dial-timeout" default:"5" yaml:"dial-timeout" json:"dial-timeout"` // 连接 Redis 服务器的超时时间 ReadTimeout time.Duration `mapstructure:"read-timeout" default:"3" yaml:"read-timeout" json:"read-timeout"` // 从 Redis 服务器读取数据的超时时间 WriteTimeout time.Duration `mapstructure:"write-timeout" default:"3" yaml:"write-timeout" json:"write-timeout"` // 向 Redis 服务器写入数据的超时时间 PoolSize int `mapstructure:"pool-size" default:"10" yaml:"pool-size" json:"pool-size" ` // 连接池的最大连接数 MinIdleConns int `mapstructure:"min-idle-conns" default:"0" yaml:"min-idle-conns" json:"min-idle-conns"` // 连接池的最小空闲连接数 MaxConnAge time.Duration `mapstructure:"max-conn-age" default:"0" yaml:"max-conn-age" json:"max-conn-age"` // 连接池中连接的最大寿命,超过这个时间将被关闭 PoolTimeout time.Duration `mapstructure:"pool-timeout" default:"4" yaml:"pool-timeout" json:"pool-timeout"` // 从连接池获取连接的超时时间 IdleTimeout time.Duration `mapstructure:"idle-timeout" default:"5" yaml:"idle-timeout" json:"idle-timeout"` // 连接池中空闲连接的超时时间 IdleCheckFrequency time.Duration `mapstructure:"idle-check-frequency" default:"1" yaml:"idle-check-frequency" json:"idle-check-frequency"` // 连接池中空闲连接的检查频率 }
type Rocketmq ¶
type Rocketmq struct { NameServer []string `mapstructure:"name-server" default:"" yaml:"name-server" json:"nameServer""` AccessKey string `mapstructure:"access-key" default:"" yaml:"access-key" json:"accessKey"` SecretKey string `mapstructure:"secret-key" default:"" yaml:"secret-key" json:"secretKey"` SecurityToken string `mapstructure:"security-token" default:"" yaml:"security-token" json:"securityToken"` Topic string `mapstructure:"topic" default:"" yaml:"topic" json:"topic"` LogLevel string `mapstructure:"log-level" default:"" yaml:"log-level" json:"logLevel"` Retry int `mapstructure:"retry" default:"" yaml:"lretry" json:"retry"` }
type Sqlite ¶
type Sqlite struct {
Datasource `yaml:",inline" mapstructure:",squash"`
}
Click to show internal directories.
Click to hide internal directories.