user

package
v0.0.0-...-291a581 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvatarMap map[uint32]string
View Source
var AvatarValues = []Avatar{
	{0x1f43b, "bear"},
	{0x1f417, "boar"},
	{0x1f431, "cat"},
	{0x1f414, "chicken"},
	{0x1f42e, "cow"},
	{0x1f98c, "deer"},
	{0x1f436, "dog"},
	{0x1f432, "dragon"},
	{0x1f985, "eagle"},
	{0x1f98a, "fox"},
	{0x1f438, "frog"},
	{0x1f992, "giraffe"},
	{0x1f98d, "gorilla"},
	{0x1f439, "hamster"},
	{0x1f434, "horse"},
	{0x1f428, "koala"},
	{0x1f981, "lion"},
	{0x1f435, "monkey"},
	{0x1f42d, "mouse"},
	{0x1f43c, "panda"},
	{0x1f437, "pig"},
	{0x1f4a9, "poop"},
	{0x1f430, "rabbit"},
	{0x1f99d, "raccoon"},
	{0x1f98f, "rhinoceros"},
	{0x1f42f, "tiger"},
	{0x1f984, "unicorn"},
	{0x1f43a, "wolf"},
	{0x1f993, "zebra"},
}

Functions

func AvatarExists

func AvatarExists(id uint32) bool

func AvatarName

func AvatarName(id uint32) string

func Route

func Route(router *gin.Engine, token *config.Token)

Types

type Avatar

type Avatar struct {
	Id   uint32
	Name string
}

type Claims

type Claims struct {
	jwt.StandardClaims
	User User `json:"user"`
}

type RouterHandler

type RouterHandler struct {
	// contains filtered or unexported fields
}

type RouterManager

type RouterManager struct {
	// contains filtered or unexported fields
}

type User

type User struct {
	Id     uuid.UUID `json:"id"`
	Name   string    `json:"name"`
	Avatar uint32    `json:"avatar"`
}

func NewUser

func NewUser() *User

func NewUserFromCookie

func NewUserFromCookie(ctx *gin.Context, tokenKey *config.Token) (*User, error)

func NewUserFromToken

func NewUserFromToken(tokenString string, tokenKey *config.Token) (*User, error)

func (*User) AvatarName

func (user *User) AvatarName() string

func (*User) AvatarPath

func (user *User) AvatarPath() string

func (*User) Delete

func (user *User) Delete(context *gin.Context)

func (*User) Refresh

func (user *User) Refresh(context *gin.Context, token *config.Token) string

func (*User) RefreshWithToken

func (user *User) RefreshWithToken(context *gin.Context, token string)

func (*User) ToJson

func (user *User) ToJson() map[string]string

func (*User) ToToken

func (user *User) ToToken(token *config.Token) (string, error)

func (*User) Valid

func (user *User) Valid(*jwt.ValidationHelper) error

Jump to

Keyboard shortcuts

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