util

package
v0.0.0-...-f839611 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BubbleSort

func BubbleSort(arr []uint) (res []uint)

BubbleSort 冒泡排序

func CheckIDCard

func CheckIDCard(idCard string) error

CheckIDCard 验证身份证号是否合法

func DecimalScoreToInt

func DecimalScoreToInt(a decimal.Decimal) int

DecimalScoreToInt 积分decimal 转整形

func DecimalToInt

func DecimalToInt(a decimal.Decimal, s int) int

DecimalToInt deciaml to int,s:-1 floor;s:0 round;s:1 ceil

func Difference

func Difference(arr1 []uint, arr2 []uint) []uint

Difference 差集计算

func GetHash

func GetHash() string

GetHash 生成hash值

func GetweekIndex

func GetweekIndex(index uint) uint

转换为我们规定的周天

func Intersect

func Intersect(arr1 []uint, arr2 []uint) []uint

Intersect 交集计算

func IsIn

func IsIn(s []uint, x uint) bool

IsIn 查询ID是否在数组中存在

func NewUUID

func NewUUID() string

NewUUID 生成新的uuid

func ParseUint

func ParseUint(key string) (uint, error)

ParseUint 转换字符串为uint

func PasswordEncry

func PasswordEncry(password string) (string, error)

PasswordEncry 密码加密

func PasswordEncryCompare

func PasswordEncryCompare(password, compare string) bool

PasswordEncryCompare 密码加密对比

func SystemDecimalToInt

func SystemDecimalToInt(a decimal.Decimal) int

SystemDecimalToInt deciaml to int

func TrimSpace

func TrimSpace(a string) string

TrimSpace 去空格

func Unsign

func Unsign(tokenString string) (uint, error)

Unsign 解密Token

func ValiateMobileNumber

func ValiateMobileNumber(mobileNumber string) error

ValiateMobileNumber 校验手机号码是否有效

func ValiatePassword

func ValiatePassword(password string) error

ValiatePassword 校验密码是否有效

func YuanToFenInt

func YuanToFenInt(a decimal.Decimal) int

YuanToFenInt 元 to 分 int

Types

type Token

type Token struct {
	UserID   uint      `json:"userID"`
	Token    string    `json:"token"`
	ExpireAt time.Time `json:"expireAt"`
}

Token 登录

func Sign

func Sign(userID uint) (*Token, error)

Sign 加密Token

Jump to

Keyboard shortcuts

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