Documentation
¶
Index ¶
- Constants
- func AddrCheck(addr string) bool
- func CheckImageFileType(header *multipart.FileHeader) (string, bool)
- func CheckToken(token string) (int64, int64, error)
- func CreateAllToken(uid int64) (string, string, error)
- func CreateToken(tokenType int64, uid int64) (string, error)
- func FileToBytes(file *multipart.FileHeader) (ret [][]byte, err error)
- func GenerateFileName(path string, id int64) string
- func GetAvailablePort() (string, error)
- func GetDeviceID(sid int64) (datacenterid, workerid int64)
- func GetEsHost() (string, error)
- func GetFloat64(d *decimal.Decimal) float64
- func GetGenTime(sid int64) (t string)
- func GetGenTimestamp(sid int64) (timestamp int64)
- func GetImageFileType(fileBytes *[]byte) (string, error)
- func GetMysqlDSN() (string, error)
- func GetTimestamp(sid int64) (timestamp int64)
- func GetTimestampStatus() (state float64)
- func HrefEncode(rawQuery string) string
- func IsSuccess(baseResp *model.BaseResp) bool
- func JSONEncode(v interface{}) (string, error)
- func LoadCNLocation() *time.Location
- func MD5(str string) string
- func MD5Bytes(str []byte) string
- func SHA256(str string) string
- func TimeParse(date string) (time.Time, error)
- func UriEncode(uri string) string
- type Claims
- type Snowflake
Constants ¶
View Source
const ( NanosecondsInAMillisecond = 1_000_000 // 每毫秒的纳秒数 MillisecondsInASecond = 1000 // 每秒的毫秒数 )
View Source
const DefaultFilePermissions = 0o666 // 默认文件权限
Variables ¶
This section is empty.
Functions ¶
func CheckImageFileType ¶
func CheckImageFileType(header *multipart.FileHeader) (string, bool)
CheckImageFileType 检查文件格式是否合规
func CheckToken ¶
CheckToken 检查 token 是否有效,并返回 token 类型和用户 ID
func CreateAllToken ¶
CreateAllToken 创建一对 token,第一个是 access token,第二个是 refresh token
func CreateToken ¶
CreateToken 根据 token 类型和用户 ID 创建 token
func FileToBytes ¶
func FileToBytes(file *multipart.FileHeader) (ret [][]byte, err error)
func GenerateFileName ¶
func GetDeviceID ¶
GetDeviceID 获取数据中心ID和机器ID
func GetFloat64 ¶
func GetGenTimestamp ¶
GetGenTimestamp 获取创建ID时的时间戳
func GetImageFileType ¶
GetImageFileType 获得图片格式
func GetTimestampStatus ¶
func GetTimestampStatus() (state float64)
GetTimestampStatus 获取时间戳已使用的占比:范围(0.0 - 1.0)
func HrefEncode ¶
HrefEncode 解析rawQuery以获得未解码的url(hertz会自动解析未解码的url)
func JSONEncode ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.