utils

package
v0.0.0-...-bf20ed2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALL logLevel = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
	OFF
)
View Source
const (
	//TimeLayout define a time format
	TimeLayout = "2006-01-02 15:04:05"
)

Variables

View Source
var (

	//LogFatal 崩溃日志记录器
	LogFatal = lgFatal.Log

	//LogError 错误日志记录器
	LogError = lgError.Log

	//LogWarn 警告日志记录器
	LogWarn = lgWarn.Log

	//LogInfo 详情日志记录器
	LogInfo = lgInfo.Log

	//LogDebug 测试日志记录器
	LogDebug = lgDebug.Log
)

DB 数据库引擎

Functions

func EnginLogger

func EnginLogger() gin.HandlerFunc

EnginLogger Gin框架的日志中间件

func FormatTime

func FormatTime(t time.Time) string

FormatTime return a formated time.Time string

func NoticManager

func NoticManager(title, content string)

NoticManager 通过ServerChan通知管理员消息

func SetConsole

func SetConsole(sw bool)

SetConsole 设置日志是否输出至控制台

func SetLogFile

func SetLogFile(fpath string) error

SetLogFile 设置日志输出文件

func TimeNow

func TimeNow() string

TimeNow return a formated time.Now() string

Types

type CacheBucket

type CacheBucket struct {
	kvcache.Bucket
	// contains filtered or unexported fields
}

func (*CacheBucket) SetWithExpireTime

func (cb *CacheBucket) SetWithExpireTime(key string, obj kvcache.ObjectCacher, t time.Duration)

type DatabaseConfig

type DatabaseConfig struct {
	DBAddress           string `json:"db_address"`
	DBPort              int    `json:"db_port"`
	DBUser              string `json:"db_user"`
	DBPassword          string `json:"db_passwd"`
	DBName              string `json:"db_name"`
	DBCharset           string `json:"charset"`
	DBIdleConnectionNum int    `json:"db_idle_connection_num"`
	DBMaxConnectionNum  int    `json:"db_max_connectiong_num"`
}

DatabaseConfig 数据库配置

var (
	//DatabaseCfg 运行时储存数据库相关配置
	DatabaseCfg *DatabaseConfig
)

func (*DatabaseConfig) Check

func (c *DatabaseConfig) Check() error

Check 检查数据库配置文件内容是否正确

func (*DatabaseConfig) String

func (c *DatabaseConfig) String() string

type SiteConfig

type SiteConfig struct {
	SiteName             string   `json:"site_name"`
	SiteDescription      string   `json:"site_description"`
	SiteKeyWords         keywords `json:"site_keywords"`
	SiteOwner            string   `json:"site_owner"`
	SiteOwnerDescription string   `json:"site_owner_description"`
	SiteOwnerWeibo       string   `json:"site_owner_weibo"`
	SiteOwnerWechat      string   `json:"site_owner_wechat"`
	SiteOwnerGithub      string   `json:"site_owner_github"`
}

SiteConfig 网站配置

Jump to

Keyboard shortcuts

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