userrepo

package
v0.0.0-...-6b47afd Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNew

func CreateNew(newUser *User) error

CreateNew inserts a new user into the collection Before inserting, checks if there is an already existing user with the same email

func IsEmailAlreadyInUse

func IsEmailAlreadyInUse(email string) (bool, error)

Types

type User

type User struct {
	mgm.DefaultModel `bson:",inline"`
	FirstName        string `json:"first_name" bson:"first_name"`
	LastName         string `json:"last_name" bson:"last_name"`
	Email            string `json:"email" bson:"email"`
	Password         string `json:"password" bson:"password"`
	IsBanned         bool   `json:"is_banned" bson:"is_banned"`
}

func GetUserByID

func GetUserByID(userID string) (*User, error)

func NewUser

func NewUser(firstName, lastName, email, password string) (*User, error)

NewUser creates a new user

func (*User) CollectionName

func (u *User) CollectionName() string

CollectionName returns the name of the collection in the database

func (*User) GetBannedStatus

func (u *User) GetBannedStatus() bool

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetFirstName

func (u *User) GetFirstName() string

func (*User) GetLastName

func (u *User) GetLastName() string

func (*User) GetPassword

func (u *User) GetPassword() string

func (*User) SetBannedStatus

func (u *User) SetBannedStatus(status bool)

func (*User) SetEmail

func (u *User) SetEmail(email string) error

func (*User) SetFirstName

func (u *User) SetFirstName(firstName string) error

func (*User) SetLastName

func (u *User) SetLastName(lastName string) error

func (*User) SetPassword

func (u *User) SetPassword(password string) error

func (*User) String

func (u *User) String() string

String is the stringer method ------ //

type Users

type Users []User

func GetAllUsers

func GetAllUsers() (Users, error)

Jump to

Keyboard shortcuts

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