helpers

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Img2Byte

func Base64Img2Byte(base64Img string) (byte []byte, err error)

Base64Img2Byte Base64图片编码转[]byte

func Cent2Yuan

func Cent2Yuan(cent int32) string

Cent2Yuan 分转元

func CheckPasswordMd5

func CheckPasswordMd5(password string, encrypt string) bool

CheckPasswordMd5 md5方式检查密码

func ContextWithRequestId

func ContextWithRequestId(ctx context.Context) context.Context

func DivCeil

func DivCeil(a, b int) int

func GenNanoId

func GenNanoId(len int) string

GenNanoId 基于NanoId生成序列号

func GenSerialNo

func GenSerialNo(len int) string

GenSerialNo 生成序列号

func GenUUID

func GenUUID() string

GenUUID 生成UUID

func GenUserNo

func GenUserNo(len int) string

GenUserNo 生成用户编号

func GetContextWithRequestId

func GetContextWithRequestId() context.Context

func GetRequestIdFromContext

func GetRequestIdFromContext(ctx context.Context) string

func Han2Pinyin

func Han2Pinyin(han string) string

Han2Pinyin 汉字转拼音

func Int64ToStringSlice

func Int64ToStringSlice(slice []int64) []string

func IntToBase62

func IntToBase62(n int) string

func IntToString

func IntToString(i interface{}) string

func IsValidPhoneNum

func IsValidPhoneNum(mobile string) bool

func Md5Encrypt

func Md5Encrypt(src string) (encrypt string)

Md5Encrypt 用MD5加密字符串

func NewProgressBar

func NewProgressBar(count int, msg string) (bar *pb.ProgressBar)

func ParseStartAndEnd

func ParseStartAndEnd(start time.Time, end time.Time) (startAt time.Time, endAt time.Time)

ParseStartAndEnd 获取开始时间的 00:00:00 和结束时间的 23:59:59

func ParseStartAndEnd2Str

func ParseStartAndEnd2Str(start time.Time, end time.Time) (string, string)

func RandomInt

func RandomInt(start, end int) int

RandomInt 产生随机数

func RemoveDuplicates

func RemoveDuplicates(s []string) []string

RemoveDuplicates 去掉切片中的重复内容

func RemoveEmoji

func RemoveEmoji(sentence string) string

RemoveEmoji 去掉字符串的Emoji

func RemovePunctuation

func RemovePunctuation(sentence string) string

RemovePunctuation 去掉字符串的标点符号

func StringToInt

func StringToInt(i interface{}) int

func StringToInt64Slice

func StringToInt64Slice(slice []string) []int64

func ToInt16

func ToInt16(i interface{}) int16

func ToInt32

func ToInt32(i interface{}) int32

func ToInt64

func ToInt64(i interface{}) int64

func ToInt8

func ToInt8(i interface{}) int8

func WsJsonMsg2Map

func WsJsonMsg2Map(jsonMsg interface{}) (res map[string]interface{}, err error)

func Yuan2Cent

func Yuan2Cent(yuan string) int32

Yuan2Cent 元转分

Types

type Sid

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

func NewSid

func NewSid() *Sid

func (Sid) GenString

func (s Sid) GenString() (string, error)

func (Sid) GenUint64

func (s Sid) GenUint64() (uint64, error)

Jump to

Keyboard shortcuts

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