util

package
v0.0.0-...-7cf99fd Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const IntMax = int(^uint(0) >> 1)
View Source
const IntMin = ^IntMax

Variables

This section is empty.

Functions

func CheckDate

func CheckDate(date string) bool

CheckDate 检查是否日期格式

func CheckIDCard

func CheckIDCard(idCard string) bool

CheckIDCard 校验身份证

func CheckMobile

func CheckMobile(mobile string, countryCode int) bool

CheckMobile 校验手机号(只校验大陆手机号)

func CheckPassword

func CheckPassword(pwd, save string) bool

CheckPassword 检查密码是否正确

func CheckTime

func CheckTime(t string) bool

CheckTime 检查是否时间格式

func ClientIP

func ClientIP(r *http.Request, c *websocket.Conn) string

ClientIP 获取客户端IP

func Exists

func Exists(p string) bool

Exists 判断路径/文件夹是否存在

func IsDir

func IsDir(p string) bool

IsDir 判断路径是否是文件夹

func IsFile

func IsFile(p string) bool

IsFile 判断是否是文件

func IsHTTPS

func IsHTTPS(ctx *gin.Context) bool

IsHTTPS 判断是否https协议

func IsMobile

func IsMobile(userAgent string) bool

IsMobile 判断是否移动端

func MixMobile

func MixMobile(mobile string) string

MixMobile 混淆手机号

func NewPassword

func NewPassword(pwd string) string

NewPassword 加密密码

func NewSequenceID

func NewSequenceID() int64

NewSequenceID 创建数字唯一编号,有重复几率

func NewUUID

func NewUUID() string

NewUUID 创建UUID唯一编号,去分隔符

func ParseTime

func ParseTime(s string, layout ...string) (time.Time, error)

ParseTime 字符串转时间,默认格式 2006-01-02 15:04:05

func RandomInt64

func RandomInt64(b ...int) int64

RandomInt64 生成指定位数的随机数字

func RandomMinMax

func RandomMinMax(min, max int64) int64

RandomMinMax 生成指定范围内的随机数字

func TimeFormat

func TimeFormat(t time.Time, layout ...string) string

TimeFormat 将时间格式化为字符串

func XRequestID

func XRequestID(ctx *gin.Context) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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