123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package model
- import "fmt"
- type Server struct {
- JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"` // jwt
- Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"` // zap log
- Email Email `mapstructure:"email" json:"email" yaml:"email"` // email
- FsLogin FsLogin `mapstructure:"fs-login" json:"fs-login" yaml:"fs-login"` // 飞书登录
- System System `mapstructure:"system" json:"system" yaml:"system"` // 系统变量
- SrcRootPath string `mapstructure:"src-root" json:"src-root" yaml:"src-root"` // 资源根目录
- NsqList []Nsq `mapstructure:"nsq-list" json:"nsq-list" yaml:"nsq-list"` // nsq
- DbLogZap bool `mapstructure:"db-log-zap" json:"db-log-zap" yaml:"db-log-zap"` // db日志
- DBList []Mysql `mapstructure:"db-list" json:"db-list" yaml:"db-list"` // mysql
- RdsList []Redis `mapstructure:"redis-list" json:"redis-list" yaml:"redis-list"` // redis
- Excel Excel `mapstructure:"excel" json:"excel" yaml:"excel"` // excel 配置
- Timer Timer `mapstructure:"timer" json:"timer" yaml:"timer"` // 定时器
- Cors CORS `mapstructure:"cors" json:"cors" yaml:"cors"` // 跨域配置
- }
- type JWT struct {
- SigningKey string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"` // jwt签名
- ExpiresTime int64 `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // 过期时间
- BufferTime int64 `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"` // 缓冲时间
- Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // 签发者
- }
- type Zap struct {
- Format string `mapstructure:"format" json:"format" yaml:"format"` // 输出
- Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // 日志前缀
- Director string `mapstructure:"director" json:"director" yaml:"director"` // 日志文件夹
- ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行
- StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名
- LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台
- }
- type Email struct {
- To string `mapstructure:"to" json:"to" yaml:"to"` // 收件人:多个以英文逗号分隔
- Port int `mapstructure:"port" json:"port" yaml:"port"` // 端口
- From string `mapstructure:"from" json:"from" yaml:"from"` // 收件人
- Host string `mapstructure:"host" json:"host" yaml:"host"` // 服务器地址
- IsSSL bool `mapstructure:"is-ssl" json:"is-ssl" yaml:"is-ssl"` // 是否SSL
- Secret string `mapstructure:"secret" json:"secret" yaml:"secret"` // 密钥
- Nickname string `mapstructure:"nickname" json:"nickname" yaml:"nickname"` // 昵称
- }
- type FsLogin struct {
- AppID string `mapstructure:"appID" json:"appID" yaml:"appID"` // 飞书应用APPID
- AppSecret string `mapstructure:"appSecret" json:"appSecret" yaml:"appSecret"` // 飞书应用AppSecret
- RedirectUri string `mapstructure:"redirectUri" json:"redirectUri" yaml:"redirectUri"` // 回调链接
- }
- type Nsq struct {
- Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口
- }
- type Casbin struct {
- ModelPath string `mapstructure:"model-path" json:"model-path" yaml:"model-path"` // 存放casbin模型的相对路径
- }
- type System struct {
- App string `mapstructure:"app" json:"app" yaml:"app"` // 项目代码
- Env string `mapstructure:"env" json:"env" yaml:"env"` // 环境值
- Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 端口值
- DbType string `mapstructure:"db-type" json:"db-type" yaml:"db-type"` // 数据库类型:db(默认)|sqlite|sqlserver|postgresql
- UseMultipoint bool `mapstructure:"use-multipoint" json:"use-multipoint" yaml:"use-multipoint"` // 多点登录拦截
- UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"` // 使用redis
- LimitCountIP int `mapstructure:"iplimit-count" json:"iplimit-count" yaml:"iplimit-count"`
- LimitTimeIP int `mapstructure:"iplimit-time" json:"iplimit-time" yaml:"iplimit-time"`
- }
- type Mysql struct {
- Disable bool `mapstructure:"disable" json:"disable" yaml:"disable"`
- ConnName string `mapstructure:"conn-name" json:"conn-name" yaml:"conn-name"`
- Path string `mapstructure:"path" json:"path" yaml:"path"` // 服务器地址:端口
- 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"` // 数据库密码
- 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"` // 打开到数据库的最大连接数
- }
- func (m *Mysql) Dsn() string {
- return fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?%s&interpolateParams=true", m.Username, m.Password, m.Path, m.Port, m.Dbname, m.Config)
- }
- type Redis struct {
- Disable bool `mapstructure:"disable" json:"disable" yaml:"disable"`
- ConnName string `mapstructure:"conn-name" json:"conn-name" yaml:"conn-name"`
- DB int `mapstructure:"db" json:"db" yaml:"db"` // redis的哪个数据库
- Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口
- Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
- }
- type Local struct {
- Path string `mapstructure:"path" json:"path" yaml:"path"` // 本地文件路径
- }
- type Excel struct {
- Dir string `mapstructure:"dir" json:"dir" yaml:"dir"`
- }
- type Timer struct {
- Start bool `mapstructure:"start" json:"start" yaml:"start"` // 是否启用
- Spec string `mapstructure:"spec" json:"spec" yaml:"spec"` // CRON表达式
- Detail []Detail `mapstructure:"detail" json:"detail" yaml:"detail"`
- }
- type Detail struct {
- TableName string `mapstructure:"tableName" json:"tableName" yaml:"tableName"` // 需要清理的表名
- CompareField string `mapstructure:"compareField" json:"compareField" yaml:"compareField"` // 需要比较时间的字段
- Interval string `mapstructure:"interval" json:"interval" yaml:"interval"` // 时间间隔
- }
- type CORS struct {
- Mode string `mapstructure:"mode" json:"mode" yaml:"mode"`
- Whitelist []CORSWhitelist `mapstructure:"whitelist" json:"whitelist" yaml:"whitelist"`
- }
- type CORSWhitelist struct {
- AllowOrigin string `mapstructure:"allow-origin" json:"allow-origin" yaml:"allow-origin"`
- AllowMethods string `mapstructure:"allow-methods" json:"allow-methods" yaml:"allow-methods"`
- AllowHeaders string `mapstructure:"allow-headers" json:"allow-headers" yaml:"allow-headers"`
- ExposeHeaders string `mapstructure:"expose-headers" json:"expose-headers" yaml:"expose-headers"`
- AllowCredentials bool `mapstructure:"allow-credentials" json:"allow-credentials" yaml:"allow-credentials"`
- }
- type GvaModel struct {
- ID int64 `db:"id" from:"id" json:"id"` // 主键ID
- CreatedAt int64 `db:"created_at" from:"created_at" json:"created_at"` // 创建时间
- UpdatedAt int64 `db:"updated_at" from:"updated_at" json:"updated_at"` // 更新时间
- }
|