models

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(filter bson.M) error

DeleteUser : delete user's data

Types

type UserBio

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

UserBio : user's biography

type UserModel

type UserModel struct {
	ID         primitive.ObjectID   `bson:"_id,omitempty" json:"_id,omitempty"`
	Email      string               `bson:"email" json:"email" binding:"required"`
	Bio        UserBio              `bson:"bio" json:"bio" binding:"omitempty"`
	Password   string               `bson:"password" json:"password" binding:"required"`
	Type       string               `bson:"type" json:"type" binding:"required"`
	Demo       bool                 `bson:"demo" json:"demo" binding:"required"`
	Securities []primitive.ObjectID `bson:"securities,omitempty" json:"securities"`
	Trade      []primitive.ObjectID `bson:"trade" json:"trade"`
	Stock      []primitive.ObjectID `bson:"stock" json:"stock"`
}

UserModel : user's model

func FindOneUser

func FindOneUser(filter bson.M) (UserModel, error)

FindOneUser : find a user

func (*UserModel) CheckPassword

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

CheckPassword : check if login password matches hashed password

func (*UserModel) CreateUser

func (u *UserModel) CreateUser() error

CreateUser : create user

func (*UserModel) HashPassword

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

HashPassword : generate password hash

func (*UserModel) UpdateUser

func (u *UserModel) UpdateUser(update bson.M) error

UpdateUser : update user's data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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