util

package
v0.0.0-...-46fca04 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(in interface{}, value interface{}, comparators ...CompareFunc) bool

func EncodeGob

func EncodeGob(s interface{}) []byte

EncodeGob encode any to byte

func EncodeMD5

func EncodeMD5(value interface{}) string

EncodeMD5 md5 encryption

func EncodeMD5File

func EncodeMD5File(file *os.File) string

EncodeMD5 md5 encryption

func GenerateToken

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

GenerateToken generate tokens used for auth

func MapToStruct

func MapToStruct(m map[string]interface{}, t interface{}) error

func RandString

func RandString(size int) string

func Setup

func Setup()

func StructToMap

func StructToMap(t interface{}) (map[string]interface{}, error)

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 CompareFunc

type CompareFunc func(i int, first interface{}, second interface{}) bool

Jump to

Keyboard shortcuts

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