Utility

package
v0.0.0-...-9eb664d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenMetaData

type TokenMetaData struct {
	TokenID   uuid.UUID `json:"tokenid"`
	UserID    int       `json:"userid"`
	IssuedAT  time.Time `json:"issuedat"`
	ExpiredAt time.Time `json:"expiredat"`
	RoleID    int       `json:"roleid"`
	jwt.RegisteredClaims
}

type Utils

type Utils struct {
	DB  *sql.DB
	RDB *redis.Client

	Mode     int
	TxOption sql.TxOptions
	// contains filtered or unexported fields
}

func NewUtility

func NewUtility(Mode int, Path string) (Utils, error)

func (*Utils) CreateToken

func (Ut *Utils) CreateToken(userId int, TokenType string) (string, error)

func (*Utils) RandomNumber

func (Ut *Utils) RandomNumber(Salt int) (int32, error)

Generate Randomnumber range between 0 and Salt .

func (*Utils) RandomString

func (Ut *Utils) RandomString(num int) (string, error)

Generate Random String of lenght num and num cannot be less than 0 and greater than 256.

func (*Utils) VerifyToken

func (Ut *Utils) VerifyToken(Token string) (bool, TokenMetaData, error)

Jump to

Keyboard shortcuts

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