models

package
v0.0.0-...-07a8822 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 8 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"`
	Username  string    `gorm:"size:100;not null;unique" json:"username"`
	Email     string    `gorm:"size:100;not null;unique" json:"email"`
	Password  string    `gorm:"size:100;not null;" json:"password"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) Delete

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

func (*User) FindAll

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

func (*User) FindByID

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

func (*User) Prepare

func (u *User) Prepare()

func (*User) Save

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

func (*User) Update

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

func (*User) Validate

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

Jump to

Keyboard shortcuts

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