models

package
v0.0.0-...-41da413 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID             uint `json:"id,omitempty" gorm:"primarykey" binding:"required"`
	CreatedAt      time.Time
	UpdatedAt      time.Time      `json:"-"`
	DeletedAt      gorm.DeletedAt `gorm:"index" json:"-"`
	Name           string         `json:"name,omitempty" gorm:"not null" binding:"required"`
	Lastname       string         `json:"lastname,omitempty" gorm:"not null" binding:"required"`
	Email          string         `json:"email,omitempty" gorm:"not null" binding:"required"`
	Role           uint           `json:"role,omitempty"`
	Active         bool           `json:"active" gorm:"default=false"`
	HashedPassword string         `json:"-" gorm:"not null"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(*gorm.DB) (err error)

func (*User) TryAuthenticate

func (u *User) TryAuthenticate(password string) (ok bool)

type UserFormData

type UserFormData struct {
	User
	Password string `json:"password" binding:"required"`
}

func (*UserFormData) GetUser

func (ufd *UserFormData) GetUser() *User

Jump to

Keyboard shortcuts

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