Documentation
¶
Index ¶
Constants ¶
View Source
const ( // App DefaultTitle = "teamlint" DefaultCopyright = "teamlint.com" DefaultTimeFormat = "2006-01-02 15:04:05" DefaultCharset = "UTF-8" DefaultDebug = false DefaultLogLevel = "error" // Server DefaultServerDebugAddr = ":5060" DefaultServerHTTPAddr = ":5050" DefaultServerGRPCAddr = ":5040" DefaultServerNATSAddr = ":4222" DefaultServerReadTimeout = "5s" DefaultServerWriteTimeout = "10s" DefaultServerIdleTimeout = "15s" DefaultServerHTMLMinify = false // Databases DefaultDatabaseName = "teamlint" DefaultDatabaseDriverName = "pgx" DefaultDatabaseConnString = "postgres://postgres:postgres@localhost/teamlint?sslmode=disable" DefaultDatabaseConnMaxLifetime = "3m" DefaultDatabaseMaxOpenConns = 100 DefaultDatabaseMaxIdleConns = 10 DefaultDatabaseLog = false )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Title string // 应用程序标题
Copyright string // 版权信息
Debug bool // 是否开启调试
LogLevel string // 日志级别: debug<info<warn<error<fatal<panic
TimeFormat string // 时间格式
Charset string // 字符集
SyncDB bool // 同步数据结构
Settings map[string]interface{} // 应用配置
}
App 应用程序
type Cache ¶
type Cache struct {
Proto string // 协议
Addr string // 地址
MaxOpenConns int // 最大连接数
MaxIdleConns int // 最大空闲连接数
ReadTimeout string // 读超时
WriteTimeout string // 写超时
}
Cache 缓存
type Config ¶
type Config struct {
*viper.Viper
App *App // 应用程序
Server *Server // 服务器配置
Databases Databases // 数据库引擎列表
Caches Caches // 缓存引擎列表
}
Config 配置
type Database ¶
type Database struct {
DriverName string // 数据库驱动名称
ConnString string // 数据库连接字符串
ConnMaxLifetime string // 连接生命周期(分钟)
MaxOpenConns int // 最大连接数
MaxIdleConns int // 最大空闲连接数
Log bool // 数据库日志
}
Database 数据库配置
type Server ¶
type Server struct {
HTTPAddr string // HTTP 服务地址
GRPCAddr string // GRPC 服务地址
NATSAddr string // NATS 服务地址
DebugAddr string // Debug 服务地址
ReadTimeout string // 读超时
WriteTimeout string // 写超时
IdleTimeout string // 空闲超时
HTMLMinify bool // 压缩HTML
BodyLog bool // Response Body 输出
}
Server 服务器
Click to show internal directories.
Click to hide internal directories.