Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Server Server `json:"server" mapstructure:"server"` // 服务端配置 Log Log `json:"log" mapstructure:"log"` // Log 日志配置 Database Database `json:"database" mapstructure:"database"` // 数据库配置 }
Config 通用配置模版
type Database ¶
type Database struct { MySQL MySQL `json:"mysql" mapstructure:"mysql"` // MySQL 数据库配置 Postgres Postgres `json:"postgres" mapstructure:"postgres"` // Postgres 数据库配置 Redis Redis `json:"redis" mapstructure:"redis"` // Redis 数据库配置 }
Database 数据库通用配置模版
type Log ¶
type Log struct { Path string `json:"path" mapstructure:"path"` // 日志存放路径 Type LogType `json:"type" mapstructure:"type"` // 日志类型。stdout:标准输出,file:文件输出 Filename string `json:"filename" mapstructure:"filename"` // 日志文件名 Level slog.Level `json:"level" mapstructure:"level"` // 日志级别。-4:debug, 0:info, 4:warn, 8:error MaxSize int `json:"max_size" mapstructure:"max_size"` // 单个日志文件最大大小,单位:MB MaxBackups int `json:"max_backups" mapstructure:"max_backups"` // 最多保存多少个日志文件 MaxAge int `json:"max_age" mapstructure:"max_age"` // 最多保存多长时间的日志文件,单位:天 }
Log 日志配置
type MySQL ¶
type MySQL struct { Host string `json:"host" mapstructure:"host"` Port string `json:"port" mapstructure:"port"` UserName string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password"` Database string `json:"database" mapstructure:"database"` }
MySQL 数据库配置
type Postgres ¶
type Postgres struct { Host string `json:"host" mapstructure:"host"` Port string `json:"port" mapstructure:"port"` UserName string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password"` Database string `json:"database" mapstructure:"database"` }
Postgres 数据库配置
type Redis ¶
type Redis struct { Host string `json:"host" mapstructure:"host"` Port int `json:"port" mapstructure:"port"` Password string `json:"password" mapstructure:"password"` Database int `json:"database" mapstructure:"database"` }
Redis 数据库配置
type Server ¶
type Server struct { Host string `json:"host" mapstructure:"host"` // host Port string `json:"port" mapstructure:"port"` // 端口 Version string `json:"version" mapstructure:"version"` // 服务版本 BasePath string `json:"base_path" mapstructure:"base_path"` // 根路径 Env Env `json:"env" mapstructure:"env"` // 所属环境 Monitor bool `json:"monitor" mapstructure:"monitor"` // 是否开启可视化监控 GlobalLimiterMax int `json:"globalLimiterMax" mapstructure:"globalLimiterMax"` // 全局限流器最大值 }
Server 服务配置
Click to show internal directories.
Click to hide internal directories.