util

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const SOLTFORMAT = "%s_%s_%s" // SOLT_DATA_SOLT

SOLTFORMAT 加盐格式

Variables

This section is empty.

Functions

func Base64ToImage

func Base64ToImage(imageBase64 string) ([]byte, error)

Base64ToImage Base64ToImage

func Black

func Black(msg string) string

Black 黑色

func Blue

func Blue(msg string) string

Blue 蓝色

func CaseToCamel

func CaseToCamel(name string) string

CaseToCamel 下划线写法转为驼峰写法

func CheckExist

func CheckExist(src string) bool

CheckExist 检查文件是否存在

func CheckPermission

func CheckPermission(src string) bool

CheckPermission 检查文件权限

func CompareHashAndPassword

func CompareHashAndPassword(e string, p string) (bool, error)

func CreateFile

func CreateFile(content bytes.Buffer, name string)

CreateFile 创建文件

func CreatePath

func CreatePath(dir string) error

CreatePath 创建文件夹

func CryptoSalt

func CryptoSalt(encode string, salt string) (verify string, err error)

CryptoSalt 根据明文和加盐值生成加密串

func Cyan

func Cyan(msg string) string

Cyan 青蓝色

func FileMonitoringByID

func FileMonitoringByID(ctx context.Context, filePth string, id string, group string, hookfn func(context.Context, string, string, []byte))

FileMonitoringByID 文件监控

func GenerateMsgIDFromContext

func GenerateMsgIDFromContext(c *gin.Context) string

GenerateMsgIDFromContext 生成msgID

func GetCurrentPath

func GetCurrentPath() string

GetCurrentPath 获取当前路径,比如:E:/abc/data/test

func GetCurrentTime

func GetCurrentTime() time.Time

GetCurrentTime 获取当前时间

func GetCurrentTimeStamp

func GetCurrentTimeStamp() int64

GetCurrentTimeStamp GetCurrentTimeStamp

func GetCurrentTimeStr

func GetCurrentTimeStr() string

GetCurrentTimeStr 获取当前时间字符串

func GetDirFiles

func GetDirFiles(dir string) ([]string, error)

GetDirFiles GetDirFiles

func GetExt

func GetExt(fileName string) string

GetExt 获取文件后缀

func GetFileSize

func GetFileSize(filename string) int64

GetFileSize 获取文件大小

func GetLocaHost

func GetLocaHost() string

GetLocaHost 获取局域网ip地址

func GetLocation

func GetLocation(ip string) string

GetLocation 获取外网ip地址

func GetSize

func GetSize(f multipart.File) (int, error)

GetSize 获取文件大小

func GetUUID

func GetUUID() string

GetUUID GetUUID

func Green

func Green(msg string) string

Green 绿色

func Hmac

func Hmac(data string) string

Hmac Hmac

func IdsStrToIdsIntGroup

func IdsStrToIdsIntGroup(key string, c *gin.Context) []int

IdsStrToIdsIntGroup 获取URL中批量id并解析

func IdsStrToIdsIntGroupStr

func IdsStrToIdsIntGroupStr(keys string) []int

IdsStrToIdsIntGroupStr 字符串转int数组

func Int64ToString

func Int64ToString(e int64) string

Int64ToString int64转字符串

func IntToString

func IntToString(e int) string

IntToString int转字符串

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir 如果不存在则新建文件夹

func IsStringEmpty

func IsStringEmpty(str string) bool

IsStringEmpty IsStringEmpty

func Lowerfirst

func Lowerfirst(str string) string

Lowerfirst 首字母小写

func Magenta

func Magenta(msg string) string

Magenta 紫红色

func MkDir

func MkDir(src string) error

MkDir 新建文件夹

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open 打开文件

func PathExists

func PathExists(path string) bool

PathExists PathExists

func Red

func Red(msg string) string

Red 红色

func RemoveRepByMap

func RemoveRepByMap(slc []string) []string

RemoveRepByMap slice去重

func Round

func Round(f float64, n int) float64

Round 浮点数小数精度

func SetColor

func SetColor(msg string, conf, bg, text int) string

SetColor 设置颜色

func SoltAESDec added in v1.0.2

func SoltAESDec(data string) string

SoltAESDec AES加盐解密

func SoltAESEnc added in v1.0.2

func SoltAESEnc(data string) string

SoltAESEnc AES加盐加密

func StringToInt

func StringToInt(e string) (int, error)

StringToInt 字符串转整型

func StructToJSONStr

func StructToJSONStr(v interface{}) (string, error)

StructToJSONStr Struct转json字符串

func Upperfirst

func Upperfirst(str string) string

Upperfirst 首字母大写

func White

func White(msg string) string

White 白色

func Yellow

func Yellow(msg string) string

Yellow 黄色

Types

type Ids

type Ids struct {
	Ids []int
}

Ids ID结构

type ReplaceHelper

type ReplaceHelper struct {
	Root    string //路径
	OldText string //需要替换的文本
	NewText string //新的文本
}

ReplaceHelper 字符串替换

func (*ReplaceHelper) DoWrok

func (h *ReplaceHelper) DoWrok() error

DoWrok 替换

Jump to

Keyboard shortcuts

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