util

package
v0.0.0-...-1911912 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 14 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 FormJson

func FormJson(jsonStr string, obj interface{}) error

func GenerateToken

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

GenerateToken generate tokens used for auth

func ParseToken

func ParseToken(token string) (interface{}, error)

ParseToken parsing token

func RandomString

func RandomString(n int, alphabets ...byte) string

随机字符串

func Setup

func Setup()

Setup Initialize the util

func ShowError

func ShowError(where string, err error)

func ToJson

func ToJson(obj interface{}) (string, error)

func TransToCharacter

func TransToCharacter(s string) string

汉字转拼音

Types

type CustomClaims

type CustomClaims struct {
	Username string `json:"username"`
	jwt.StandardClaims
}

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