Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmqpConfig ¶
type AmqpConfig struct { User string `mapstructure:"user" yaml:"user"` Password string `mapstructure:"password" yaml:"password"` Host string `mapstructure:"host" yaml:"host"` Port string `mapstructure:"port" yaml:"port"` URL string `mapstructure:"url" yaml:"url"` Exchange string `mapstructure:"exchange" yaml:"exchange" default:"amq.direct"` Queue string `mapstructure:"queue" yaml:"queue"` RoutingKey string `mapstructure:"routing_key" yaml:"routing_key"` AutoDelete bool `mapstructure:"auto_delete" yaml:"auto_delete"` }
type DatabaseConfig ¶
type DatabaseConfig struct { DSN string `mapstructure:"dsn" yaml:"dsn"` // 数据源名称 Driver string `mapstructure:"driver" yaml:"driver"` // 数据库驱动名称 Host string `mapstructure:"host" yaml:"host"` // 数据库主机 Port int `mapstructure:"port" yaml:"port"` // 数据库端口 DBName string `mapstructure:"dbname" yaml:"dbname"` // 数据库名称 Username string `mapstructure:"username" yaml:"username"` // 数据库用户名 Password string `mapstructure:"password" yaml:"password"` // 数据库密码 Charset string `mapstructure:"charset" yaml:"charset"` // 数据库字符集 Collation string `mapstructure:"collation" yaml:"collation"` // 数据库排序规则 Timeout string `mapstructure:"timeout" yaml:"timeout"` // 连接超时时间 ReadTimeout string `mapstructure:"read_timeout" yaml:"read_timeout"` // 读取超时时间 WriteTimeout string `mapstructure:"write_timeout" yaml:"write_timeout"` // 写入超时时间 ParseTime bool `mapstructure:"parse_time" yaml:"parse_time"` // 解析时间戳 Protocol string `mapstructure:"protocol" yaml:"protocol"` // 数据库协议 Loc string `mapstructure:"loc" yaml:"loc"` // 时区 ConnMaxIdle int `mapstructure:"conn_max_idle" yaml:"conn_max_idle"` // 连接池最大空闲连接数 ConnMaxOpen int `mapstructure:"conn_max_open" yaml:"conn_max_open"` // 连接池最大打开连接数 ConnMaxLifetime string `mapstructure:"conn_max_lifetime" yaml:"conn_max_lifetime"` // 连接池连接的最大生命周期 }
type FetcherConfig ¶
type FetcherConfig struct { RequireRateLimiter bool Timeout time.Duration `mapstructure:"timeout" yaml:"timeout"` // 连接超时时间 // Fetcher的请求头配置 HeaderConfig struct { UserAgent string `mapstructure:"user_agent" yaml:"user_agent"` // 用户代理 AcceptLanguage string `mapstructure:"accept_language" yaml:"accept_language"` // 接受的语言 AcceptCharset string `mapstructure:"accept_charset" yaml:"accept_charset"` // 接受的字符集 Origin string `mapstructure:"origin" yaml:"origin"` // 请求来源 } `mapstructure:"header" yaml:"header"` // Fetcher的速率限制配置 RateLimiterConfig struct { EachSec int `mapstructure:"each_sec" yaml:"each_sec"` // 每秒允许的API请求次数限制 Each2Min int `mapstructure:"each_2min" yaml:"each_2min"` // 每两分钟允许的API请求次数限制 } `mapstructure:"rate_limiter" yaml:"rate_limiter"` }
type LoggerConfig ¶
type LoggerConfig struct { MaxSize int `mapstructure:"maxsize" yaml:"maxsize"` // 日志的最大大小,以M为单位 MaxBackups int `mapstructure:"maxbackups" yaml:"maxbackups"` // 保留的旧日志文件的最大数量 MaxAge int `mapstructure:"maxage" yaml:"maxage"` // 保留旧日志文件的最大天数 LocalTime bool `mapstructure:"localtime" yaml:"localtime"` // 是否使用本地时间 Compress bool `mapstructure:"compress" yaml:"compress"` // 是否压缩旧日志文件 }
type MicroServ ¶
type MicroServ struct { // Domain string `mapstructure:"domain" yaml:"domain"` ID string `mapstructure:"id" yaml:"id"` // 服务ID Name string `mapstructure:"name" yaml:"name"` // 服务名 GRPCListenAddress string `mapstructure:"grpc_listen_address" yaml:"grpc_listen_address"` // gRPC监听地址 HTTPListenAddress string `mapstructure:"http_listen_address" yaml:"http_listen_address"` // HTTP监听地址 RegistryAddress string `mapstructure:"registry_address" yaml:"registry_address"` // 注册中心地址 RegistryPort string `mapstructure:"registry_port" yaml:"registry_port"` // 注册中心端口 RegisterTTL time.Duration `mapstructure:"register_ttl" yaml:"register_ttl"` // 注册TTL(Time-to-Live) RegisterInterval time.Duration `mapstructure:"register_interval" yaml:"register_interval"` // 注册间隔 ClientTimeOut time.Duration `mapstructure:"client_timeout" yaml:"client_timeout"` // 客户端超时时间 }
type RedisConfig ¶
type RedisConfig struct { Host string `yaml:"host" mapstructure:"host"` // Redis 服务器地址 Port int `yaml:"port" mapstructure:"port"` // Redis 端口 DB int `yaml:"db" mapstructure:"db"` // Redis 数据库索引 Username string `yaml:"username" mapstructure:"username"` // Redis 用户名 Password string `yaml:"password" mapstructure:"password"` // Redis 密码 ConnMinIdle int `yaml:"conn_min_idle" mapstructure:"conn_min_idle"` // 连接池最小空闲连接数 ConnMaxOpen int `yaml:"conn_max_open" mapstructure:"conn_max_open"` // 连接池最大连接数 ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" mapstructure:"conn_max_lifetime"` // 连接数最大生命周期 ConnMaxIdleTime time.Duration `yaml:"conn_max_idletime" mapstructure:"conn_max_idletime"` // 连接数空闲时长 Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"` // 连接超时时间 ReadTimeout time.Duration `yaml:"read_timeout" mapstructure:"read_timeout"` // 读超时时间 WriteTimeout time.Duration `yaml:"write_timeout" mapstructure:"write_timeout"` // 写超时时间 }
type Root ¶
type Root struct { Env string `mapstructure:"env"` DirTree *DirTree Dbconf *DatabaseConfig `mapstructure:"database"` RedisConf *RedisConfig `mapstructure:"redis"` LogConf *LoggerConfig `mapstructure:"logger"` Fetcher *FetcherConfig `mapstructure:"fetcher"` Micro *MicroServ `mapstructure:"micro"` Router *Router `mapstructure:"router"` JwtConf *JwtConfig `mapstructure:"jwt"` EmailConf *EmailConf `mapstructure:"smtp"` AmqpConf *AmqpConfig `mapstructure:"amqp"` }
Click to show internal directories.
Click to hide internal directories.