setting

package
v0.0.0-...-bad5a63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Conf      = config{}
	ConfViper = viper.New()
)

Functions

func SetupSetting

func SetupSetting()

SetupSetting 实例化配置文件

Types

type App

type App struct {
	// 开发模式:dev prod test
	RunMode string `json:"runMode" toml:"runMode"`
}

type DB

type DB struct {
	// 数据库驱动
	DriverName string `json:"driverName" toml:"driverName"`
	// 数据库用户名
	Username string `json:"username" toml:"username"`
	// 数据库密码
	Password string `json:"password" toml:"password"`
	// 数据库服务器地址
	Host string `json:"host" toml:"host"`
	// 数据库服务器端口
	Port int `json:"port" toml:"port"`
	// 数据库名称
	Dbname string `json:"dbname" toml:"dbname"`
	// 数据库其他配置
	Config string `json:"config" toml:"config"`
	// 数据库最大空闲连接数
	MaxIdleConns int `json:"maxIdleConns" toml:"maxIdleConns"`
	// 数据库最大连接数
	MaxOpenConns int `json:"maxOpenConns" toml:"maxOpenConns"`
	// 是否开启Gorm全局日志
	LogMode bool `json:"logMode" toml:"logMode"`
}

DB 数据源

type Lumberjack

type Lumberjack struct {
	// 每个日志文件保存10M,默认 100M
	MaxSize int `json:"maxSize" toml:"maxSize"`
	// 保留30个备份,默认不限
	MaxBackups int `json:"maxBackups" toml:"maxBackups"`
	// 保留7天,默认不限
	MaxAge int `json:"maxAge" toml:"maxAge"`
	// 是否压缩,默认不压缩
	Compress bool `json:"compress" toml:"compress"`
	//使用计算机时间作为备份时间
	LocalTime bool `json:"localTime" toml:"localTime"`
}

type Server

type Server struct {
	// 服务器地址
	HttpAddr string `json:"httpAddr" toml:"httpAddr"`
	// 读超时时间
	ReadTimeout int `json:"readTimeout" toml:"readTimeout"`
	// 写超时时间
	WriteTimeout int `json:"writeTimeout" toml:"writeTimeout"`
}

type SnowFlake

type SnowFlake struct {
	// 雪花算法工作站id
	WorkerId int64 `json:"workerId" toml:"workerId""`
}

type SuperAdmin

type SuperAdmin struct {
	// 超级管理员用户名
	Username string `json:"username" toml:"username"`
	// 密码
	Password string `json:"password" toml:"password"`
}

type Zap

type Zap struct {
	// 级别
	Level string `json:"level" toml:"level"`
	// 输出格式,json/console可选
	Format string `json:"format" toml:"format"`
	// 日志前缀
	Prefix string `json:"prefix" toml:"prefix"`
	// 日志文件夹
	Directory string `json:"directory" toml:"directory"`
	// 软链接名称
	LinkName string `json:"linkName" toml:"linkName"`
	// 显示行
	ShowLine bool `json:"showLine" toml:"showLine"`
	// 编码器选择
	EncodeLevel string `json:"encodeLevel" toml:"encodeLevel"`
	// 栈名
	StacktraceKey string `json:"stacktraceKey" toml:"stacktraceKey"`
	// 输出控制台
	LogInConsole bool `json:"logInConsole" toml:"logInConsole"`
	// 日志切割
	Lumberjack Lumberjack `json:"lumberjack" toml:"lumberjack"`
}

Zap zap日志

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL