user

package
v0.0.0-...-e02a78a Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	ID        uint    `gorm:"primaryKey" json:"-"`
	Groupname string  `gorm:"unique" json:"groupname"`
	Members   []*User `gorm:"many2many:user_groups"`
}

func (Group) MarshalJSON

func (c Group) MarshalJSON() ([]byte, error)

func (Group) MarshalYAML

func (c Group) MarshalYAML() (any, error)

func (*Group) UnmarshalJSON

func (c *Group) UnmarshalJSON(b []byte) error

func (*Group) UnmarshalYAML

func (c *Group) UnmarshalYAML(b *yaml.Node) error

type User

type User struct {
	ID        uint              `gorm:"primaryKey" json:"-"`
	Username  string            `gorm:"unique" json:"username"`
	Password  password.Password `json:"password"`
	StudentId string            `json:"studentId"`
	Email     string            `gorm:"unique" json:"email"`
	Groups    []*Group          `gorm:"many2many:user_groups" json:"groups"`
}

func GetUser

func GetUser(query any, args ...any) (user User, err error)

func GetUsers

func GetUsers() ([]User, error)

func (User) ContainGroup

func (user User) ContainGroup(group string) bool

func (*User) Create

func (user *User) Create() error

func (*User) Fix

func (user *User) Fix()

func (User) GenToken

func (user User) GenToken(data string) (string, error)

func (User) ToMap

func (user User) ToMap() (result map[string]any)

func (*User) Update

func (user *User) Update() error

func (User) VerifyToken

func (user User) VerifyToken(token, data string) bool

Jump to

Keyboard shortcuts

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