model

package
v0.0.0-...-72b4c0b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: GPL-3.0 Imports: 9 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"`
	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: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 UnmarshalUser

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

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) DeleteAUser

func (u *User) DeleteAUser(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 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) Validate

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

type UserResponse

type UserResponse struct {
	ID       uint32 `json:"id" copier:"must"`
	FullName string `json:"full_name"`
	Name     string `json:"name"`
	LastName string `json:"last_name"`
	Nickname string `json:"nickname"`
	IdCard   string `json:"id_card"`
	Email    string `json:"email" copier:"must"`
}

Jump to

Keyboard shortcuts

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