Documentation
¶
Index ¶
- func Init() *viper.Viper
- func InitConfig()
- type Aliyun
- type Auth
- type Cache
- type Config
- type DB
- type Elasticsearch
- type Email
- type Jwt
- type LogConfig
- type Milvus
- type Mysql
- type Pay
- type Postgres
- func (p *Postgres) GetDatabase() string
- func (p *Postgres) GetHost() string
- func (p *Postgres) GetMaxIdleConns() int
- func (p *Postgres) GetMaxOpenConns() int
- func (p *Postgres) GetPassword() string
- func (p *Postgres) GetPingTimeout() time.Duration
- func (p *Postgres) GetPort() int
- func (p *Postgres) GetSSLMode() string
- func (p *Postgres) GetUser() string
- type Qiniu
- type Redis
- type Server
- type Upload
- type Wx
- type WxPay
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶ added in v1.0.1
func InitConfig()
Types ¶
type Aliyun ¶ added in v1.0.1
type Aliyun struct {
AccessKeyID *string `mapstructure:"accessKeyId"`
AccessKeySecret *string `mapstructure:"accessKeySecret"`
Endpoint *string `mapstructure:"endpoint"`
Bucket *string `mapstructure:"bucket"`
}
Aliyun 阿里云配置
func (*Aliyun) GetAccessKeyID ¶ added in v1.0.6
func (*Aliyun) GetAccessKeySecret ¶ added in v1.0.6
func (*Aliyun) GetEndpoint ¶ added in v1.0.6
type Auth ¶
type Auth struct {
IsAuth *bool `mapstructure:"isAuth"`
Ignores []string `mapstructure:"ignores"`
NeedLogins []string `mapstructure:"needLogins"`
}
func (*Auth) GetIgnores ¶ added in v1.0.3
type Cache ¶
type Cache struct {
NeedCache []string `mapstructure:"needCache"`
Expire *int64 `mapstructure:"expire"` //单位秒
}
func (*Cache) GetNeedCache ¶ added in v1.0.3
type Config ¶
type Config struct {
Pay *Pay `mapstructure:"pay"`
Server *Server `mapstructure:"server"`
Cache *Cache `mapstructure:"cache"`
Upload *Upload `mapstructure:"upload"`
Qiniu *Qiniu `mapstructure:"qiniu"`
Aliyun *Aliyun `mapstructure:"aliyun"`
DB *DB `mapstructure:"db"`
Auth *Auth `mapstructure:"auth"`
Wx *Wx `mapstructure:"wx"`
Jwt *Jwt `mapstructure:"jwt"`
Email *Email `mapstructure:"email"`
Log *LogConfig `mapstructure:"log"`
Elasticsearch *Elasticsearch `mapstructure:"elasticsearch"`
Milvus *Milvus `mapstructure:"milvus"`
}
type Elasticsearch ¶ added in v1.0.5
type Elasticsearch struct {
Addresses []string `mapstructure:"addresses"`
Username *string `mapstructure:"username"`
Password *string `mapstructure:"password"`
APIKey *string `mapstructure:"apiKey"`
}
Elasticsearch 配置结构体
func (*Elasticsearch) GetAPIKey ¶ added in v1.0.5
func (e *Elasticsearch) GetAPIKey() string
GetAPIKey 获取 ES API Key
func (*Elasticsearch) GetAddresses ¶ added in v1.0.5
func (e *Elasticsearch) GetAddresses() []string
GetAddresses 获取 ES 地址列表
func (*Elasticsearch) GetPassword ¶ added in v1.0.5
func (e *Elasticsearch) GetPassword() string
GetPassword 获取 ES 密码
func (*Elasticsearch) GetUsername ¶ added in v1.0.5
func (e *Elasticsearch) GetUsername() string
GetUsername 获取 ES 用户名
type Email ¶ added in v1.0.2
type Email struct {
Host *string `mapstructure:"host"`
Port *int `mapstructure:"port"`
Username *string `mapstructure:"username"`
Password *string `mapstructure:"password"`
Identity *string `mapstructure:"identity"`
From *string `mapstructure:"from"`
BaseURL *string `mapstructure:"baseUrl"`
}
func (*Email) GetBaseURL ¶ added in v1.0.3
func (*Email) GetIdentity ¶ added in v1.0.3
func (*Email) GetPassword ¶ added in v1.0.3
func (*Email) GetUsername ¶ added in v1.0.3
type Jwt ¶
type Jwt struct {
Secret *string `mapstructure:"secret"`
Expire *time.Duration `mapstructure:"expire"`
Refresh *time.Duration `mapstructure:"refresh"`
}
func (*Jwt) GetRefresh ¶ added in v1.0.3
type LogConfig ¶ added in v1.0.1
type LogConfig struct {
Level *string `mapstructure:"level"`
Format *string `mapstructure:"format"`
AddSource *bool `mapstructure:"addSource"`
Filename *string `mapstructure:"filename"`
MaxSize *int `mapstructure:"maxSize"`
MaxAge *int `mapstructure:"maxAge"`
MaxBackups *int `mapstructure:"maxBackups"`
Output io.Writer `mapstructure:"output"`
}
func (*LogConfig) GetAddSource ¶ added in v1.0.3
func (*LogConfig) GetFilename ¶ added in v1.0.3
func (*LogConfig) GetMaxBackups ¶ added in v1.0.3
func (*LogConfig) GetMaxSize ¶ added in v1.0.3
type Milvus ¶ added in v1.0.5
type Milvus struct {
Address *string `mapstructure:"address"`
DBName *string `mapstructure:"dbName"`
Username *string `mapstructure:"username"`
Password *string `mapstructure:"password"`
}
Milvus 配置结构体
func (*Milvus) GetAddress ¶ added in v1.0.5
GetAddress 获取 Milvus 地址
func (*Milvus) GetPassword ¶ added in v1.0.5
GetPassword 获取 Milvus 密码
func (*Milvus) GetUsername ¶ added in v1.0.5
GetUsername 获取 Milvus 用户名
type Mysql ¶
type Mysql struct {
Host *string `mapstructure:"host"`
Port *int `mapstructure:"port"`
User *string `mapstructure:"user"`
Password *string `mapstructure:"password"`
Database *string `mapstructure:"database"`
MaxIdleConns *int `mapstructure:"maxIdleConns"`
PingTimeout *time.Duration `mapstructure:"pingTimeout"`
MaxOpenConns *int `mapstructure:"maxOpenConns"`
}
func (*Mysql) GetDatabase ¶ added in v1.0.3
func (*Mysql) GetMaxIdleConns ¶ added in v1.0.3
func (*Mysql) GetMaxOpenConns ¶ added in v1.0.3
func (*Mysql) GetPassword ¶ added in v1.0.3
func (*Mysql) GetPingTimeout ¶ added in v1.0.3
type Postgres ¶ added in v1.0.1
type Postgres struct {
Host *string `mapstructure:"host"`
Port *int `mapstructure:"port"`
User *string `mapstructure:"user"`
Password *string `mapstructure:"password"`
Database *string `mapstructure:"database"`
SSLMode *string `mapstructure:"sslmode"`
MaxIdleConns *int `mapstructure:"maxIdleConns"`
PingTimeout *time.Duration `mapstructure:"pingTimeout"`
MaxOpenConns *int `mapstructure:"maxOpenConns"`
}
func (*Postgres) GetDatabase ¶ added in v1.0.3
func (*Postgres) GetMaxIdleConns ¶ added in v1.0.3
func (*Postgres) GetMaxOpenConns ¶ added in v1.0.3
func (*Postgres) GetPassword ¶ added in v1.0.3
func (*Postgres) GetPingTimeout ¶ added in v1.0.3
func (*Postgres) GetSSLMode ¶ added in v1.0.3
type Redis ¶
type Redis struct {
Addr *string `mapstructure:"addr"`
Password *string `mapstructure:"password"`
DB *int `mapstructure:"db"`
PoolSize *int `mapstructure:"poolSize"`
IdleTimeout *int `mapstructure:"idleTimeout"`
MaxOpenConns *int `mapstructure:"maxOpenConns"`
MaxIdleConns *int `mapstructure:"maxIdleConns"`
}
func (*Redis) GetMaxIdleConns ¶ added in v1.0.3
func (*Redis) GetMaxOpenConns ¶ added in v1.0.3
func (*Redis) GetPassword ¶ added in v1.0.3
func (*Redis) GetPoolSize ¶ added in v1.0.3
type Server ¶
type Server struct {
Port *int `mapstructure:"port"`
Cros []string `mapstructure:"cros"`
AllowOrigins []string `mapstructure:"allowOrigins"`
Mode *string `mapstructure:"mode"`
Name *string `mapstructure:"name"`
Version *string `mapstructure:"version"`
Host *string `mapstructure:"host"`
ReadTimeout *time.Duration `mapstructure:"readTimeout"`
WriteTimeout *time.Duration `mapstructure:"writeTimeout"`
}
func (*Server) GetReadTimeout ¶ added in v1.0.3
func (*Server) GetWriteTimeout ¶ added in v1.0.3
type WxPay ¶
type WxPay struct {
AppId *string `mapstructure:"appId"`
MchId *string `mapstructure:"mchId"` //商户证书的证书序列号
MchSerialNo *string `mapstructure:"mchSerialNo"` //商户证书的证书序列号
ApiV3Key *string `mapstructure:"apiV3Key"` //apiV3Key,商户平台获取
PrivateKey *string `mapstructure:"privateKey"` //私钥 apiclient_key.pem 读取后的内容
AppSecret *string `mapstructure:"appSecret"`
NotifyUrl *string `mapstructure:"notifyUrl"`
MchCertPath *string `mapstructure:"mchCertPath"`
MchKeyPath *string `mapstructure:"mchKeyPath"`
}
func (*WxPay) GetNotifyUrl ¶ added in v1.0.3
Click to show internal directories.
Click to hide internal directories.