util

package
v0.0.0-...-6dcb45d Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TokenExpireTime = 86400 * 7

用户token默认过期时间,单位秒

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to string without a memory allocation.

func CompareTimeString

func CompareTimeString(time1, time2 string) bool

func FmtStr2YMDHMS

func FmtStr2YMDHMS(str string) string

func FormatBaiduTicketKey

func FormatBaiduTicketKey(ticket string) string

func FormatFaucetKey

func FormatFaucetKey(uid uint, coin string) string

func FormatToStr

func FormatToStr(str string) (str2 string)

判断日期

func FormatToString

func FormatToString(str string) (str2 string)

*

  • 获取日期的描述
  • @param str {string} 时间字符串
  • @return str2 {string} 日期的描述

func FormatTokenUserKey

func FormatTokenUserKey(token string) string

token找uid

func FormatUserEEIDKey

func FormatUserEEIDKey(eeid uint) string

eeid找uid

func FormatUserLimitKey

func FormatUserLimitKey(userid uint) string

func FormatUserTokenKey

func FormatUserTokenKey(uid uint) string

uid找token

func GenToken

func GenToken() string

生成token

func GetAddMonthFormat

func GetAddMonthFormat(month int) string

func GetDataSubValue

func GetDataSubValue(newData string) (day, hour, minute, second float64)

*

  • @Description : 计算两个日期的差值
  • @Date : 2019-04-12 12:22
  • @Modify : return day hour minute second

func GetDateFormat

func GetDateFormat(t time.Time) string

func GetDateItem

func GetDateItem(t *time.Time) (year int, month int, day int)

获取日期的年月日

func GetDayLatestTime

func GetDayLatestTime() time.Time

func GetEventTime

func GetEventTime(str string) (param1, param2, param3 string, res bool)

报表事件入库参数

func GetMonthDays

func GetMonthDays(year int, month int) int

获取某月有多少天

func GetNextTime

func GetNextTime(duration string) string

时间运算

func GetNowDateDayFormat

func GetNowDateDayFormat() string

func GetNowDateFormat

func GetNowDateFormat() string

func GetNowDateTimeFormat

func GetNowDateTimeFormat() string

func GetNowDateTimeFormatByFormat

func GetNowDateTimeFormatByFormat(format string) string

func GetNowDateTimeFormatCustom

func GetNowDateTimeFormatCustom(format string) string

func GetNowDayFormat

func GetNowDayFormat() string

func GetNowMonthFormat

func GetNowMonthFormat() string

func GetNowTime

func GetNowTime() string

时间字符串

func GetNowTime4Day

func GetNowTime4Day() string

时间字符串

func GetNowTimestap

func GetNowTimestap() int64

获取当前时间戳,单位毫秒

func GetNowTimestapByString

func GetNowTimestapByString(dataStr string, format string) int64

func GetNowTsBySeconds

func GetNowTsBySeconds() int64

获取当前时间戳,单位秒

func GetNowYearFormat

func GetNowYearFormat() string

func GetNowYearMoth

func GetNowYearMoth() []string

时间字符串

func GetStringTime4Day

func GetStringTime4Day(str string) (param1 string, res bool)

获取报表查询时间参数

func GetTime7Day

func GetTime7Day(start string, num int) (string, string)

获取某时刻多少天前的时间

func GetTimeAfterDay

func GetTimeAfterDay(start string, num int) string

获取某时刻多少天后的时间

func GetTimeAfterMinute

func GetTimeAfterMinute(start string, num int) time.Time

获取某时刻多少分钟后的时间

func GetTimeArray

func GetTimeArray(startTime, endTime string) []string

获取

func GetTimeBeforeDay

func GetTimeBeforeDay(start string, num int) (string, string)

获取某时刻多少天前的时间

func GetTimeBeforeMinute

func GetTimeBeforeMinute(start string, num int) string

获取某时刻多少分钟前的时间

func GetTimeFormat

func GetTimeFormat(ts int64) string

func GetTimeFormatCustom

func GetTimeFormatCustom(ts int64, format string) string

func GetTimeFromDefaultString

func GetTimeFromDefaultString(str string) time.Time

func GetTimeItem

func GetTimeItem(t *time.Time) (hour int, min int, sec int)

获取时间的时分秒

func GetTimeString

func GetTimeString() (y, m, d string)

报表时间: 年月日

func GetTimeWithLayout

func GetTimeWithLayout(ts int64, layout string) string

func HeaderCheck

func HeaderCheck(c *gin.Context) error

func IsLeapYear

func IsLeapYear(year int) bool

判断是否为闰年

func LocalToUtc

func LocalToUtc(localTime string) string

func StringSha256

func StringSha256(str string) string

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts string to byte slice without a memory allocation.

func TimeStampToString

func TimeStampToString(ts int64) string

func UtcToLocal

func UtcToLocal(utcTime string) string

Types

type UserToken

type UserToken struct {
	Name       string `json:"name"`
	UID        uint   `json:"uid"` // 用户id
	Token      string `json:"token"`
	ExpireTime int64  `json:"expire_time"` // 过期时间戳
}

用户token信息

Jump to

Keyboard shortcuts

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