util

package
v3.0.0-...-3373b9d Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 13 Imported by: 20

Documentation

Index

Constants

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

Variables

View Source
var Level = LevelDebug

Functions

func BuildConcat

func BuildConcat(str1, str2 string, DBType string) string

BuildConcat 根据数据库类型构建字符串连接表达式

func BuildLogger

func BuildLogger(level string)

BuildLogger 构建logger

func BuildRegexp

func BuildRegexp(search []string, prefix, suffix, condition string) string

BuildRegexp 构建用于SQL查询用的多条件正则

func ClearSession

func ClearSession(c *gin.Context)

ClearSession 清空session

func ContainsString

func ContainsString(s []string, e string) bool

ContainsString 返回list中是否包含

func ContainsUint

func ContainsUint(s []uint, e uint) bool

ContainsUint 返回list中是否包含

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 IsInExtensionList

func IsInExtensionList(extList []string, fileName string) bool

IsInExtensionList 返回文件的扩展名是否在给定的列表范围内

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 SliceDifference

func SliceDifference(slice1, slice2 []string) []string

SliceDifference 求两个切片差集

func SliceIntersect

func SliceIntersect(slice1, slice2 []string) []string

SliceIntersect 求两个切片交集

func SplitPath

func SplitPath(path string) []string

SplitPath 分割路径为列表

Types

type Logger

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

Logger 日志

var GloablLogger *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