utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelError 错误
	LevelError = iota
	// LevelWarning 警告
	LevelWarning
	// LevelInformational 提示
	LevelInformational
	// LevelDebug 除错
	LevelDebug
)

Variables

View Source
var Level = LevelDebug

Functions

func BuildLogger

func BuildLogger(level string)

BuildLogger 构建logger

func ClearSession

func ClearSession(c *gin.Context)

ClearSession 清空session

func CreatNestedFile

func CreatNestedFile(path string) (*os.File, error)

CreatNestedFile 给定path创建文件,如果目录不存在就递归创建

func DeleteSession

func DeleteSession(c *gin.Context, key string)

DeleteSession 删除session

func DotPathToStandardPath

func DotPathToStandardPath(path string) string

DotPathToStandardPath 将","分割的路径转换为标准路径

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func FillSlash

func FillSlash(path string) string

FillSlash 给路径补全`/`

func FormSlash

func FormSlash(old string) string

FormSlash 将path中的反斜杠'\'替换为'/'

func GetSession

func GetSession(c *gin.Context, key string) interface{}

GetSession 获取session

func IsEmpty

func IsEmpty(name string) (bool, error)

IsEmpty 返回给定目录是否为空目录

func ParseQRCode

func ParseQRCode(QRCode *multipart.FileHeader) (string, error)

func RandStringRunes

func RandStringRunes(n int) string

RandStringRunes 返回随机字符串

func RelativePath

func RelativePath(name string) string

RelativePath 获取相对可执行文件的路径

func RemoveSlash

func RemoveSlash(path string) string

RemoveSlash 移除路径最后的`/`

func Replace

func Replace(table map[string]string, s string) string

Replace 根据替换表执行批量替换

func SetSession

func SetSession(c *gin.Context, list map[string]interface{})

SetSession 设置session

func SplitPath

func SplitPath(path string) []string

SplitPath 分割路径为列表

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger 日志

var GlobalLogger *Logger

func Log

func Log() *Logger

Log 返回日志对象

func (*Logger) Debug

func (ll *Logger) Debug(format string, v ...interface{})

Debug 校验

func (*Logger) Error

func (ll *Logger) Error(format string, v ...interface{})

Error 错误

func (*Logger) Info

func (ll *Logger) Info(format string, v ...interface{})

Info 信息

func (*Logger) Panic

func (ll *Logger) Panic(format string, v ...interface{})

Panic 极端错误

func (*Logger) Println

func (ll *Logger) Println(prefix string, msg string)

Println 打印

func (*Logger) Warning

func (ll *Logger) Warning(format string, v ...interface{})

Warning 警告

Jump to

Keyboard shortcuts

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