user

package
v0.0.0-...-a953039 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unverified = "unverified"
	Verified   = "verified"
	Admin      = "admin"
	Banned     = "banned"
)

Variables

This section is empty.

Functions

func Count

func Count(filter bson.M) (int64, error)

Types

type User

type User struct {
	ID       primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Email    string             `json:"email" bson:"email,required"`
	Username string             `json:"username" bson:"username,required"`
	Password string             `json:"password" bson:"password,required"`
	Access   string             `json:"access" bson:"access, required"`
}

func FindAll

func FindAll(filter bson.M) ([]*User, error)

func FindOne

func FindOne(filter bson.M) (*User, error)

func FromJSON

func FromJSON(u string) (*User, error)

func (*User) Authenticate

func (u *User) Authenticate(password string) (bool, error)

func (*User) GenerateJWT

func (u *User) GenerateJWT() (string, error)

func (*User) Save

func (u *User) Save() (primitive.ObjectID, error)

func (*User) ToJSON

func (u *User) ToJSON() (string, error)

Jump to

Keyboard shortcuts

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