models

package
v0.0.0-...-3edba42 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	gorm.Model
	Name string `json:"name" binding:"required" gorm:"unique"`
}

type User

type User struct {
	gorm.Model
	Name     string `json:"name" binding:"required"`
	Email    string `json:"email" binding:"required" gorm:"unique"`
	Password string `json:"password" binding:"required"`
}

func (*User) CheckPassword

func (user *User) CheckPassword(providedPassword string) error

Checks the providedPassword for against the user.Password field

func (*User) HashPassword

func (user *User) HashPassword(password string) error

Takes a password string as a parameter and encrypts it using bcrypt, saves the result into user.Password field

Jump to

Keyboard shortcuts

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