helper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePwd

func ComparePwd(hashPwd string, plainPwd []byte) bool

密码验证

func Contains

func Contains(array interface{}, val interface{}) (index int)

判断array contain item

func Convert

func Convert(array interface{}) string

[a] -> a -> a [a b c] -> a b c -> a,b,c

func FirstElement

func FirstElement(args []string) string

FirstElement 安全地获取 args[0],避免 panic: runtime error: index out of range

func FirstLower

func FirstLower(s string) string

func FirstUpper

func FirstUpper(s string) string

func GetClientIP

func GetClientIP(c *gin.Context) string

func GetFuncName

func GetFuncName(i interface{}, seps ...rune) string

GetFuncName 获取函数名称

func GetKeys

func GetKeys(m map[string]string) []string

func GetSum

func GetSum(m []int) int

func GetTotalPage

func GetTotalPage(total, size int) int

func GetValues

func GetValues(m map[string]string) []string

func HashAndSalt

func HashAndSalt(pwd []byte) string

加密

func Int64ToInt

func Int64ToInt(num int64) int

func IntToBool

func IntToBool(num int8) bool

func MD5

func MD5(str []byte, b ...byte) string

MD5 MD5加密

func MaheHump

func MaheHump(s string) string

MaheHump 将字符串转换为驼峰命名

func RandomNumber

func RandomNumber(length int) string

RandomNumber 生成长度为 length 随机数字字符串

func ReturnQ

func ReturnQ(length int) string

func SliceAfter

func SliceAfter(str string, substr string) string

SliceAfter 截取指定标识后面的内容

func SliceBefore

func SliceBefore(str string, substr string) string

SliceBefore 截取指定标识前面的内容

func StructColumn

func StructColumn(desk, input interface{}, columnKey, indexKey string) (err error)

实现 php 中的array_column 方法 @param desk [slice|map] 指针类型,方法最终的存储位置 @param input []struct,待转换的结构体切片 @param columnKey string @param indexKey string

func TrimSpace

func TrimSpace(text string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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