Documentation
¶
Overview ¶
@Title @Description @Author Wangwengang 2023/12/10 12:07 @Update Wangwengang 2023/12/10 12:07
@Title @Description @Author Wangwengang 2023/12/10 12:06 @Update Wangwengang 2023/12/10 12:06
@Title @Description @Author Wangwengang 2023/12/12 23:58 @Update Wangwengang 2023/12/12 23:58
@Title @Description @Author Wangwengang 2023/12/13 20:44 @Update Wangwengang 2023/12/13 20:44
@Title @Description @Author Wangwengang 2023/12/14 04:30 @Update Wangwengang 2023/12/14 04:30
@Title @Description @Author Wangwengang 2023/12/10 18:45 @Update Wangwengang 2023/12/10 18:45
@Title @Description @Author Wangwengang 2023/12/16 14:44 @Update Wangwengang 2023/12/16 14:44
@Title @Description @Author Wangwengang 2023/12/12 09:08 @Update Wangwengang 2023/12/12 09:08
@Title @Description @Author Wangwengang 2023/12/10 12:05 @Update Wangwengang 2023/12/10 12:05
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Slog Slog `json:"slog" yaml:"slog" mapstructure:"slog"` Gateway Gateway `mapstructure:"gateway" json:"gateway" yaml:"gateway"` RPC RPC `mapstructure:"rpc" yaml:"rpc" json:"rpc"` RpcService RpcService `mapstructure:"rpc-service" yaml:"rpc-service" json:"rpcService"` Nsq Nsq `mapstructure:"nsq" yaml:"nsq" json:"nsq"` Redis Redis `mapstructure:"redis" yaml:"redis" json:"redis"` RootPath string `yaml:"root-path" json:"rootPath" mapstructure:"root-path"` DBList []SpecializedDB `mapstructure:"db-list" json:"db-list" yaml:"db-list"` Jaeger Jaeger `mapstructure:"jaeger" json:"jaeger" yaml:"jaeger"` CertPath string `mapstructure:"cert-path" json:"certPath" yaml:"cert-path"` KeyPath string `mapstructure:"key-path" json:"keyPath" yaml:"key-path"` Mongo Mongo `mapstructure:"mongo" json:"mongo" yaml:"mongo"` }
var S_CONF Config
type DsnProvider ¶
type DsnProvider interface {
Dsn() string
}
type Gateway ¶
type Gateway struct { Env string `mapstructure:"env" json:"env" yaml:"env"` // 环境值 PrivateRouterPrefix string `mapstructure:"private-router-prefix" json:"privateRouterPrefix" yaml:"private-router-prefix"` PublicRouterPrefix string `mapstructure:"public-router-prefix" yaml:"public-router-prefix" json:"publicRouterPrefix"` Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 端口值 LimitCountIP int `mapstructure:"iplimit-count" json:"iplimit-count" yaml:"iplimit-count"` LimitTimeIP int `mapstructure:"iplimit-time" json:"iplimit-time" yaml:"iplimit-time"` CertPath string `mapstructure:"cert-path" json:"certPath" yaml:"cert-path"` KeyPath string `mapstructure:"key-path" json:"keyPath" yaml:"key-path"` }
type GeneralDB ¶
type GeneralDB struct { Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` Port string `mapstructure:"port" json:"port" yaml:"port"` Config string `mapstructure:"config" json:"config" yaml:"config"` // 高级配置 Dbname string `mapstructure:"db-name" json:"db-name" yaml:"db-name"` // 数据库名 Username string `mapstructure:"username" json:"username" yaml:"username"` // 数据库密码 Password string `mapstructure:"password" json:"password" yaml:"password"` // 数据库密码 Path string `mapstructure:"path" json:"path" yaml:"path"` Engine string `mapstructure:"engine" json:"engine" yaml:"engine" default:"InnoDB"` //数据库引擎,默认InnoDB LogMode string `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode"` // 是否开启Gorm全局日志 MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns"` // 空闲中的最大连接数 MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"` // 打开到数据库的最大连接数 Singular bool `mapstructure:"singular" json:"singular" yaml:"singular"` //是否开启全局禁用复数,true表示开启 LogZap bool `mapstructure:"log-zap" json:"log-zap" yaml:"log-zap"` // 是否通过zap写入日志文件 }
GeneralDB 也被 Pgsql 和 Mysql 原样使用
type Mongo ¶ added in v0.1.5
type Mongo struct {
Uri string `yaml:"uri" json:"uri" mapstructure:"uri"`
}
type Mysql ¶
type Mysql struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
func (*Mysql) GetLogMode ¶
type Nsq ¶
type Nsq struct { NsqlookupdAddr string `json:"nsqlookupdAddr" yaml:"nsqlookupd-addr" mapstructure:"nsqlookupd-addr"` NsqdAddrList []string `json:"nsqdAddrList" yaml:"nsqd-addr-list" mapstructure:"nsqd-addr-list"` WorkerPoolSize uint32 `json:"workerPoolSize" yaml:"worker-pool-size" mapstructure:"worker-pool-size"` MaxTaskChanLen uint32 `json:"maxTaskChanLen" yaml:"max-task-chan-len" mapstructure:"max-task-chan-len"` // The maximum length of the send buffer message queue.(SendBuffMsg发送消息的缓冲最大长度) MaxNsqDataChanLen uint32 `json:"maxNsqDataChanLen" yaml:"max-nsq-data-chan-len" mapstructure:"max-nsq-data-chan-len"` Channel string `json:"channel" yaml:"channel" mapstructure:"channel"` Concurrency int `json:"concurrency" yaml:"concurrency" mapstructure:"concurrency"` MaxInFlight int `json:"maxInFlight" yaml:"max-in-flight" mapstructure:"max-in-flight"` }
type RpcService ¶
type Slog ¶
type Slog struct { Level string `mapstructure:"level" json:"level" yaml:"level"` // 级别 Format string `mapstructure:"format" json:"format" yaml:"format"` // 输出 Director string `mapstructure:"director" json:"director" yaml:"director"` // 日志文件夹 EncodeLevel string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"` // 编码级 StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名 Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // 前缀 IsAllInOne bool `mapstructure:"is-all-in-one" json:"IsAllInOne" yaml:"is-all-in-one"` // 日志是否按类别区分 MaxAge int `mapstructure:"max-age" json:"max-age" yaml:"max-age"` // 日志留存时间 ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行 LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台 LogInSentry bool `mapstructure:"log-in-sentry" json:"log-in-sentry" yaml:"log-in-sentry"` // 输出Sentry LogInSentryLevel string `mapstructure:"log-in-sentry-level" json:"log-in-sentry-level" yaml:"log-in-sentry-level"` // 输出SentryLevel SentryDsn string `mapstructure:"sentry-dsn" json:"sentry-dsn" yaml:"sentry-dsn"` // SentryDSN LogInNsq bool `mapstructure:"log-in-nsq" json:"log-in-nsq" yaml:"log-in-nsq"` // 输出到nsq }