model

package
v0.0.0-...-f2baea1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

func VerifyPassword

func VerifyPassword(password string, hash string) bool

Types

type User

type User struct {
	ID        uint32    `gorm:"primary_key;auto_increment" json:"id"`
	FullName  string    `gorm:"size:255;null;" json:"full_name"`
	Name      string    `gorm:"size:100;not null;" json:"name"`
	LastName  string    `gorm:"size:100;not null;" json:"last_name"`
	Nickname  string    `gorm:"size:50;null;unique" json:"nickname"`
	IdCard    string    `gorm:"size:30;not null;unique" json:"id_card"`
	Email     string    `gorm:"size:100;not null;unique" json:"email"`
	Password  string    `gorm:"size:250;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 UnmarshalUser

func UnmarshalUser(data []byte) (User, error)

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) DeleteUser

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

func (*User) FindAllUsers

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

func (*User) FindUserByEmail

func (u *User) FindUserByEmail(db *gorm.DB, email string) (*User, error)

func (*User) FindUserByID

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

func (*User) Marshal

func (r *User) Marshal() ([]byte, 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) ValidUser

func (u *User) ValidUser(db *gorm.DB, email string, password string) (bool, 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