Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = fmt.Errorf("Product not found")
ErrNotFound => product not found
Functions ¶
func GetProducts ¶
GetProducts returns all products from the database
Types ¶
type Product ¶
type Product struct { // gorm.Model ID int `json:"id"` Brand string `json:"brand" validate:"required"` Title string `json:"title" validate:"required"` Description string `json:"desc" validate:"required"` Price float64 `json:"price" validate:"required"` }
Product structure
type User ¶
type User struct { gorm.Model UserName string `json:"username" gorm:"size:15;unique_index" validate:"required"` FirstName string `json:"first_name" gorm:"size:15" validate:"required"` LastName string `json:"last_name" gorm:"size:15" validate:"required"` Email string `json:"email" gorm:"type:varchar(100);unique_index" validate:"required"` Password string `json:"password" gorm:"size:255" validate:"required"` }
User model
func (*User) SetPassword ¶
SetPassword role is to hash user password
Click to show internal directories.
Click to hide internal directories.