models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) ([]byte, error)

func VerifyPassword

func VerifyPassword(hashedPassword, password string) error

Types

type User

type User struct {
	ID       uint32 `gorm:"primary_key;auto_increment" json:"id"`
	Name     string `gorm:"size:200;not null;unique" json:"name"`
	Email    string `gorm:"size:200;not null;unique" json:"email"`
	Password string `gorm:"size:200;not null;" json:"password"`
	Admin    bool   `gorm:"type:bool;default:false;" json:"admin"`
}

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) DeleteUser

func (u *User) DeleteUser(db *gorm.DB, uid uint32) (int64, error)

func (*User) FindAllUsers

func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)

func (*User) FindUserByID

func (u *User) FindUserByID(db *gorm.DB, uid uint32) (*User, error)

func (*User) Prepare

func (u *User) Prepare()

func (*User) SaveUser

func (u *User) SaveUser(db *gorm.DB) (*User, error)

func (*User) UpdateUser

func (u *User) UpdateUser(db *gorm.DB, uid uint32) (*User, error)

func (*User) Validate

func (u *User) Validate(action string) error

type Wine

type Wine struct {
	ID          uint64 `gorm:"primary_key;auto_increment" json:"id"`
	Name        string `gorm:"size:200;not null;unique" json:"title"`
	Description string `gorm:"size:200;not null;" json:"content"`
	Year        string `gorm:"size:200;not null;" json:"year"`
	Price       string `gorm:"size:200;not null;" json:"price"`
	Image       string `gorm:"size:200;not null;" json:"image"`
	Available   bool   `gorm:"type:bool;default:false" json:"available"`
}

func (*Wine) DeleteWine

func (w *Wine) DeleteWine(db *gorm.DB, pid uint64) (int64, error)

func (*Wine) FindAllWines

func (w *Wine) FindAllWines(db *gorm.DB) (*[]Wine, error)

func (*Wine) FindWineByID

func (w *Wine) FindWineByID(db *gorm.DB, pid uint64) (*Wine, error)

func (*Wine) Prepare

func (w *Wine) Prepare()

func (*Wine) SaveWine

func (w *Wine) SaveWine(db *gorm.DB) (*Wine, error)

func (*Wine) UpdateWine

func (w *Wine) UpdateWine(db *gorm.DB) (*Wine, error)

func (*Wine) Validate

func (w *Wine) Validate() error

Jump to

Keyboard shortcuts

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