util

package
v0.0.0-...-7313388 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func GenerateToken

func GenerateToken(username, password string) (string, error)

GenerateToken generate tokens used for auth

func GetPage

func GetPage(request *restful.Request) int

GetPage 获取page参数

func GetPageSize

func GetPageSize(request *restful.Request) int

GetPageSize 获取pageSize参数

func IntSliceToString

func IntSliceToString(int_arr []int) string

IntSliceToString int切片转字符串

func StringSliceToString

func StringSliceToString(int_arr []string) string

StringSliceToString string切片转字符串

func StringToIntSlice

func StringToIntSlice(str string) []int

StringToIntSlice 字符串转int切片

func StringToStringSlice

func StringToStringSlice(str string) []string

StringToStringSlice 字符串转String切片

func ValidatorMap

func ValidatorMap() map[string]interface{}

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

ParseToken parsing token

type JSONTime

type JSONTime struct {
	time.Time
}

JSONTime format json time field by myself

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON on JSONTime format Time field with %Y-%m-%d %H:%M:%S

func (*JSONTime) Scan

func (t *JSONTime) Scan(v interface{}) error

Scan valueof time.Time

func (JSONTime) Value

func (t JSONTime) Value() (driver.Value, error)

Value insert timestamp into mysql need this function.

Jump to

Keyboard shortcuts

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