models

package
v0.0.0-...-dcd259a Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExistingUser

func IsExistingUser(email string) (found bool, err error)

IsExistingUser examines if an user account is already registered with the given email id.

Types

type User

type User struct {
	UserName         string        `json:"username" bson:"username"`
	FirstName        string        `json:"firstname" bson:"firstname"`
	LastName         string        `json:"lastname" bson:"lastname"`
	Name             string        `json:"name" bson:"name"`
	Email            string        `json:"email" bson:"email"`
	Password         string        `json:"password" bson:"password"`
	SubscribeToEmail bool          `json:"subscribe" bson:"subscribe"`
	Id               bson.ObjectId `json:"id" bson:"_id"` // Data type  bson.ObjectId is for mongodb bson format
}

User holds basic information regarding site user MongoDB represents JSON documents in binary-encoded format called BSON behind the scenes. BSON extends the JSON model to provide additional data types and to be efficient for encoding and decoding within different languages

func FindUser

func FindUser(id string) (User, error)

func GetUserByEmail

func GetUserByEmail(email string) (User, error)

GetUserByEmail returns a user account information if is already registered with the given email id.

func (User) Insert

func (u User) Insert() error

Insert adds user information to database

func (User) Update

func (u User) Update() error

Jump to

Keyboard shortcuts

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