users

package
v0.0.0-...-a6aec48 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id" json:"_id"`
	FirstName string             `bson:"first_name" json:"first_name"`
	LastName  string             `bson:"last_name" json:"last_name"`
	Username  string             `bson:"username" json:"username"`
	Email     string             `bson:"email" json:"email"`
	Password  string             `bson:"password" json:"password"`
	Role      string             `bson:"role" json:"role"`
}

func NewUser

func NewUser(firstName string, lastName string, username string, email string, hashedPassword string, role string) (*User, error)

func (*User) IsCorrectPassword

func (user *User) IsCorrectPassword(password string) bool

Compares hashedpassword from db to provided password

func (*User) RequiredFields

func (user *User) RequiredFields() error

RequiredFields checks that the required field are not empty

func (*User) Validate

func (user *User) Validate() error

Jump to

Keyboard shortcuts

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