util

package
v0.0.0-...-e432ecc Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IP = new(ipUtil)

Functions

func CopyProperties

func CopyProperties[T any](from any) (to T)

拷贝属性, 一般用于 vo -> po

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func FailMessage

func FailMessage(c *gin.Context, message string)

func GenerateToken

func GenerateToken(claims Claims) (string, error)

GenerateToken generate tokens used for auth

func GetOffset

func GetOffset(req request.PageQuery) (offset int)

GetPage get page parameters

func OK

func OK(c *gin.Context)

func Response

func Response(c *gin.Context, errCode int, data interface{})

func Setup

func Setup()

Setup Initialize the util

Types

type Claims

type Claims struct {
	UserID uint64 `json:"id"`
	Role   *int   `json:"role"`
	jwt.StandardClaims
}

func ParseToken

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

ParseToken parsing token

type ResponseEntity

type ResponseEntity struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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