models

package
v0.0.0-...-beb99c9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUser

func NewUser() *mongo.Collection

NewUser makes a user collection

Types

type UserSchema

type UserSchema struct {
	ID       interface{} `bson:"_id,omitempty" json:"_id,omitempty"`
	Email    string      ` bson:"email" json:"email"`
	Password []byte      `json:"password,omitempty" json:"password,omitempty"`
}

UserSchema Document

func (UserSchema) CompareHashAndPassword

func (schema UserSchema) CompareHashAndPassword(hashedPassword, password []byte) bool

CompareHashAndPassword compares a bcrypt hashed password with its possible plaintext equivalent. Returns true on success, or false on failure.

func (UserSchema) HashPassword

func (schema UserSchema) HashPassword(password string) []byte

HashPassword hashes a passwrd from string and updates it

Jump to

Keyboard shortcuts

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