util

package
v0.0.0-...-5a8df17 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: GPL-3.0 Imports: 11 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 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 ContainsString

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

ContainsString 返回list中是否包含

func ContainsUint

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

ContainsUint 返回list中是否包含

func ConvertToString

func ConvertToString(src string, srcCode string, tagCode string) string

编码转换

func CreatNestedFile

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

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

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

func IfIntArray

func IfIntArray(condition bool, trueVal, falseVal []int) []int

func IfStringArray

func IfStringArray(condition bool, trueVal, falseVal []string) []string

func IsEmpty

func IsEmpty(name string) (bool, error)

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

func RandStringRunes

func RandStringRunes(n int) string

RandStringRunes 返回随机字符串

func Replace

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

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

func SliceDifference

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

SliceDifference 求两个切片差集

func SliceIntersect

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

SliceIntersect 求两个切片交集

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