utils

package
v0.0.0-...-85027f2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRC16

func CRC16(data []byte) uint16

CRC16 计算数据的crc16校验码

func CheckOperationType

func CheckOperationType(workStat constdefine.WorkStatusEnum, needOperation constdefine.OpTypeEnum) bool

校验操作类型是否有效

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func GenerateToken

func GenerateToken(id string) (string, error)

GenerateToken generate tokens used for auth

func GetPage

func GetPage(c *gin.Context) int

GetPage get page parameters

func GunCode2CanIndex

func GunCode2CanIndex(devType, gunCode int) int

guncode和canindex的转换

func JoinKey

func JoinKey[T ~string](a, b T, sep string, ex ...T) string

JoinKey 拼接缓存key

func PlatStat2DevStat

func PlatStat2DevStat(statType, statValue string) (constdefine.WorkStatusEnum, error)

PlatStat2DevStat 平台状态字符串转换为设备状态

func Setup

func Setup()

Setup Initialize the utils

Types

type Claims

type Claims struct {
	ID string `json:"id"`
	jwt.StandardClaims
}

func ParseToken

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

ParseToken parsing token

Jump to

Keyboard shortcuts

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