Back to

Package utils

Latest Go to latest

The latest major version is .

Published: Sep 9, 2020 | License: MIT | Module:


func DeleteElemFromUint64Slice

func DeleteElemFromUint64Slice(i int, a []uint64) []uint64

从slice删除元素 fast version, 会改变顺序 i:slice的索引值 a: slice

func DeleteElemOrderFromUint64Slice

func DeleteElemOrderFromUint64Slice(i int, a []uint64) []uint64

从slice删除元素 slow version, 保持原有顺序 i:slice的索引值 a: slice

func GenShortId

func GenShortId() (string, error)

func GetAvatarUrl

func GetAvatarUrl(key string) string

user's avatar, if empty, use default avatar

func GetDate

func GetDate() string

func GetDefaultAvatarUrl

func GetDefaultAvatarUrl() string

func GetQiNiuPublicAccessUrl

func GetQiNiuPublicAccessUrl(path string) string

获取七牛资源的公有链接 无需配置bucket, 域名会自动到域名所绑定的bucket去查找

func GetReqID

func GetReqID(c *gin.Context) string

func GetShowTime

func GetShowTime(ts time.Time) string


func GetStaticImageUrl

func GetStaticImageUrl(key string) string

func GetTodayDateInt

func GetTodayDateInt() int


func Md5

func Md5(str string) (string, error)


func StringSliceContains

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

字符串切片中是否包含另一个字符串 来自go源码 net/http/server.go

func StringSliceEqual

func StringSliceEqual(a, b []string) bool

判断 string slice 是否相等 使用了传统的遍历方式

func StringSliceReflectEqual

func StringSliceReflectEqual(a, b []string) bool

判断 string slice 是否相等 因为使用了反射,所以效率较低,可以看benchmark结果

func TimeLayout

func TimeLayout() string

func TimeToShortString

func TimeToShortString(ts time.Time) string

func TimeToString

func TimeToString(ts time.Time) string

func Uint64ShuffleSlice

func Uint64ShuffleSlice(a []uint64) []uint64

func Uint64SliceReverse

func Uint64SliceReverse(a []uint64) []uint64

uint64 slice 反转

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier