adminmodel

package
v0.0.0-...-48f0708 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Example = Model{
	ID:       primitive.NewObjectID(),
	Email:    "someone@something.com",
	Password: "password",
}

Example ... A sample use

Functions

func DeleteAdmin

func DeleteAdmin(filter bson.M) error

DeleteAdmin ...

Types

type Bio

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

Bio : user's biography

type Model

type Model struct {
	ID                   primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Email                string             `bson:"email" json:"email" binding:"required,email"`
	Bio                  Bio                `bson:"bio" json:"bio" binding:"omitempty"`
	Password             string             `bson:"password" json:"password" binding:"required,min=8"`
	PasswordConfirmation string             `json:"passwordConfirmation" binding:"required,min=8,eqfield=Password"`
	Role                 string             `bson:"role" json:"role" binding:"required"`
	EmployeeID           string             `bson:"employee_id" json:"employee_id" binding:"omitempty"`
}

Model : user's model

func FindOneAdmin

func FindOneAdmin(filter bson.M) (Model, error)

FindOneAdmin ...

func (*Model) CheckPassword

func (u *Model) CheckPassword(password string) error

CheckPassword ...

func (*Model) CreateAdmin

func (u *Model) CreateAdmin() error

CreateAdmin ...

func (*Model) GenerateEmployeeID

func (u *Model) GenerateEmployeeID()

GenerateEmployeeID ...

func (*Model) HashPassword

func (u *Model) HashPassword(password string) error

HashPassword ...

func (*Model) UpdateAdmin

func (u *Model) UpdateAdmin(update bson.M) error

UpdateAdmin ...

Jump to

Keyboard shortcuts

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