core

package
v0.0.0-...-d827859 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Conf = &conf{}
)

Functions

func CustomTimeEncoder

func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

自定义日志输出时间格式

func GetWriteSyncer

func GetWriteSyncer() (zapcore.WriteSyncer, error)

func GormMysql

func GormMysql() *gorm.DB

func GormSqlite

func GormSqlite() *gorm.DB

func InitConfig

func InitConfig(tomlPath string)

func InitConn

func InitConn() *gorm.DB

func InitRedis

func InitRedis()

func InitZap

func InitZap() (logger *zap.Logger)

Types

type DBConf

type DBConf struct {
	DBType string
	DBUser string
	DBPwd  string
	DBHost string
	DBName string
}

type RedisConf

type RedisConf struct {
	RedisAddr string
	RedisPWD  string
	RedisDB   int
}

type SettingConf

type SettingConf struct {
	HttpPort     int `json:"http-port"`
	ReadTimeout  int `json:"read-timeout"`
	WriteTimeout int `json:"write-timeout"`
	RunMode      string
	PageSize     int
	JwtSecret    string
	UploadTmpDir string
	ImgSavePath  string
	ImgUrlPath   string
}

type ZapLogConf

type ZapLogConf struct {
	Level         string `json:"level" yaml:"level"`
	Format        string ` json:"format" yaml:"format"`
	Prefix        string ` json:"prefix" yaml:"prefix"`
	Director      string ` json:"director"  yaml:"director"`
	LinkName      string ` json:"linkName" yaml:"link-name"`
	ShowLine      bool   ` json:"showLine" yaml:"showLine"`
	EncodeLevel   string ` json:"encodeLevel" yaml:"encode-level"`
	StacktraceKey string `json:"stacktraceKey" yaml:"stacktrace-key"`
	LogInConsole  bool   `json:"logInConsole" yaml:"log-in-console"`
}

Jump to

Keyboard shortcuts

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