models

package
v0.0.0-...-bbd85db Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

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

Types

type User

type User struct {
	Id        uint32    `gorm:"primary_key;auto_increment" json:"id"`
	Name      string    `gorm:"size:255;not null" json:"name"`
	Email     string    `gorm:"type:varchar(100);unique_index" json:"email"`
	Password  string    `gorm:"type:varchar(255);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) All

func (u *User) All() *[]User

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) FindByEmail

func (u *User) FindByEmail(email string) (*User, error)

func (*User) FindById

func (u *User) FindById(id int) (*User, error)

func (*User) Prepare

func (u *User) Prepare()

func (*User) Save

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

func (*User) VerifyPassword

func (u *User) VerifyPassword(password string) error

Jump to

Keyboard shortcuts

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