helper

package
v0.0.0-...-66b41b3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePassword

func EncodePassword(password string, slat string) string

func GenerateSlat

func GenerateSlat() string

func GenerateToken

func GenerateToken(payload TokenPayload) string

func GetNowTime

func GetNowTime() time.Time

func GetUniAuthAccessToken

func GetUniAuthAccessToken(code string) (string, error)

func HttpGet

func HttpGet(url string) ([]byte, error)

func HttpGetJSON

func HttpGetJSON(url string, v interface{}) error

func Md5

func Md5(data string) string

func ValidateJSON

func ValidateJSON(obj interface{}, c *gin.Context) bool

func ValidateQuery

func ValidateQuery(obj interface{}, c *gin.Context) bool

func ValidateUri

func ValidateUri(obj interface{}, c *gin.Context) bool

Types

type AccessTokenJSON

type AccessTokenJSON struct {
	AccessToken string `json:"accessToken"`
}

type CustomClaims

type CustomClaims struct {
	jwt.StandardClaims
	TokenPayload
}

func ParseToken

func ParseToken(tokenString string) *CustomClaims

type Res

type Res struct {
	// contains filtered or unexported fields
}

func (*Res) BadRequest

func (r *Res) BadRequest(message string) *Res

func (*Res) Code

func (r *Res) Code(code int) *Res

func (*Res) Data

func (r *Res) Data(data interface{}) *Res

func (*Res) Error

func (r *Res) Error(message string) *Res

func (Res) Get

func (r Res) Get(c *gin.Context)

func (*Res) Message

func (r *Res) Message(message string) *Res

func (*Res) NotFound

func (r *Res) NotFound(message string) *Res

func (*Res) ServerError

func (r *Res) ServerError(err error) *Res

func (*Res) Status

func (r *Res) Status(status int) *Res

func (*Res) Success

func (r *Res) Success(data interface{}) *Res

func (*Res) Unauthorized

func (r *Res) Unauthorized(message string) *Res

type TokenPayload

type TokenPayload struct {
	ID   uint   `json:"id"`
	Slat string `json:"slat"`
}

Jump to

Keyboard shortcuts

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