utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var XRequestID = "X-Request-ID"

XRequestID

Functions

func GenRequestID

func GenRequestID() string

GenRequestID eg: 76d27e8c-a80e-48c8-ad20-e5562e0f67e4

func GenShortID

func GenShortID() (string, error)

GenShortID

func GetAvatarURL

func GetAvatarURL(key string) string

GetAvatarURL user's avatar, if empty, use default avatar

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

GetBytes interface to byte

func GetDate

func GetDate() string

GetDate

func GetDefaultAvatarURL

func GetDefaultAvatarURL() string

GetDefaultAvatarURL

func GetLocalIP

func GetLocalIP() string

GetLocalIP

func GetQiNiuPublicAccessURL

func GetQiNiuPublicAccessURL(path string) string

GetQiNiuPublicAccessURL

func GetRealIP

func GetRealIP(ctx *gin.Context) (ip string)

GetRealIP get user real ip

func GetRequestID

func GetRequestID(c *gin.Context) string

GetRequestID

func GetTodayDateInt

func GetTodayDateInt() int

GetTodayDateInt

func IsEmail

func IsEmail(email string) bool

func IsEmpty

func IsEmpty(s string) bool

IsEmpty

func IsInSlice

func IsInSlice(value interface{}, sli interface{}) bool

IsInSlice

func Md5

func Md5(str string) (string, error)

Md5

func RandomStr

func RandomStr(n int) string

RandomStr

func RegexpReplace

func RegexpReplace(reg, src, temp string) string

RegexpReplace ...

func ReplaceDNS1123

func ReplaceDNS1123(name string) string

is match dns label

func SliceShuffle

func SliceShuffle(slice []interface{})

SliceShuffle shuffle a slice

func StringSliceContains

func StringSliceContains(ss []string, s string) bool

StringSliceContains

func StringSliceEqual

func StringSliceEqual(a, b []string) bool

StringSliceEqual

func StringSliceReflectEqual

func StringSliceReflectEqual(a, b []string) bool

StringSliceReflectEqual

func StringToInt

func StringToInt(str string) (int, error)

StringToInt

func StringToInt64

func StringToInt64(str string) (int64, error)

StringToInt64

func StringToUint64

func StringToUint64(str string) (uint64, error)

StringToUint64

func TimeLayout

func TimeLayout() string

TimeLayout

func TimeToShortString

func TimeToShortString(ts time.Time) string

TimeToShortString

func TimeToString

func TimeToString(ts time.Time) string

TimeToString

func Uint64DeleteElemInSlice

func Uint64DeleteElemInSlice(i int, s []uint64) []uint64

func Uint64DeleteElemInSliceWithOrder

func Uint64DeleteElemInSliceWithOrder(i int, s []uint64) []uint64

func Uint64ShuffleSlice

func Uint64ShuffleSlice(a []uint64) []uint64

Uint64ShuffleSlice

func Uint64SliceReverse

func Uint64SliceReverse(a []uint64) []uint64

Uint64SliceReverse

Types

This section is empty.

Jump to

Keyboard shortcuts

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