users

package
v0.0.0-...-cf20ef5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOne

func CreateOne(Name string, Lastname string, Password string, Email string, Username string, Roles []string) (result interface{}, err error)

CreateUserSchema @desc: adds schema validation and indexes to collection

func DeleteOne

func DeleteOne(filter bson.M) (result bson.M, err error)

func FindOne

func FindOne(filter bson.M) (result bson.M, err error)

func List

func List(filter interface{}, page, limit int64) (result *utils.Result, err error)

func UpdateOne

func UpdateOne(filter bson.M, update bson.M) (result bson.M, err error)

Types

type User

type User struct {
	Id       primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Username string             `json:"username,omitempty" bson:"username,omitempty" validate:"required,min=3,max=60"`
	Email    string             `json:"email,omitempty" bson:"email,omitempty" validate:"required,email"`
	Password string             `json:"password,omitempty" bson:"password,omitempty" validate:"required,password,min=10,max=60"`
	Name     string             `json:"name,omitempty" bson:"name,omitempty" validate:"required,min=3,max=60"`
	Lastname string             `json:"lastname,omitempty" bson:"lastname,omitempty" validate:"required,min=3,max=60"`
	Roles    []string           `json:"roles" bson:"roles" default:"['user']" validate:"required,min=3,max=60"`
}

Jump to

Keyboard shortcuts

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