jwt

package
v0.0.0-...-8845b87 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(user User) (string, error)

Types

type Claims

type Claims struct {
	UserID   uint64
	Username string
	jwt.RegisteredClaims
}

func ParseToken

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

type User

type User struct {
	ID       uint64 `json:"id,omitempty" gorm:"primary_key; auto_increment"`
	Username string `json:"username" binding:"required" gorm:"type:varchar(50);unique_index"`
	Email    string `json:"email" binding:"required,email" gorm:"type:varchar(100)"`
	Password string `json:"password" binding:"required" gorm:"type:varchar(30)"`
}

Jump to

Keyboard shortcuts

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