util

package
v0.0.0-...-8170b65 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 15 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 EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func GetClientIP

func GetClientIP(c *gin.Context) string

func GetFrontLimit

func GetFrontLimit(c *gin.Context) int

func GetFrontPage

func GetFrontPage(c *gin.Context) int

func GetKeys

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

func GetPage

func GetPage(c *gin.Context) int

func GetSize

func GetSize(c *gin.Context) int

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 RandomNumber

func RandomNumber(length int) string

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

func ReturnQ

func ReturnQ(length int) string

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

Types

type Worker

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

定义一个worker工作节点所需要的基本参数

func NewWorker

func NewWorker(workerId int64) (*Worker, error)

实例化一个工作节点

func (*Worker) GetId

func (w *Worker) GetId() int64

接下来我们开始生成id 生成方法一定要挂载在某个worker下,这样逻辑会比较清晰 指定某个节点生成id

Jump to

Keyboard shortcuts

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