models

package
v0.0.0-...-0e42b2a Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserTokenTable = "user_tokens"
	MethodVerified = "verified"
	MethodForgot   = "forgot"
)
View Source
const UserTable = "users"

Variables

This section is empty.

Functions

This section is empty.

Types

type ForgotPassForm

type ForgotPassForm struct {
	Email string `form:"email"    validate:"required,max=100,email"            json:"email"`
}

type ReSendVerificationForm

type ReSendVerificationForm struct {
	Email string `form:"email"    validate:"required,max=100,email"            json:"email"`
}

type ResetPassForm

type ResetPassForm struct {
	Token    string `form:"token"        validate:"required,min=5,max=5"              json:"-"`
	Email    string `form:"email"        validate:"required,max=100,email"            json:"email"`
	Password string `form:"password"     validate:"required,max=100"                  json:"-"`
	Confirm  string `form:"confirm"      validate:"required,max=100,eqfield=Password" json:"-"`
}

type UpdatePasswordForm

type UpdatePasswordForm struct {
	OldPassword string `form:"password_old" validate:"required,max=100"                  json:"-"`
	Password    string `form:"password"     validate:"required,max=100"                  json:"-"`
	Confirm     string `form:"confirm"      validate:"required,max=100,eqfield=Password" json:"-"`
}

type User

type User struct {
	ID         uint      `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	Name       string    `gorm:"column:name"                        json:"name"`
	Email      string    `gorm:"column:email"                       json:"email"`
	Password   string    `gorm:"column:password"                    json:"-"`
	Gender     string    `gorm:"column:gender"                      json:"gender"`
	Image      string    `gorm:"column:image"                       json:"image"`
	VerifiedAt time.Time `gorm:"column:verified_at;default:null"    json:"-"`
	CreatedAt  time.Time `gorm:"column:created_at"                  json:"-"`
	UpdatedAt  time.Time `gorm:"column:updated_at"                  json:"-"`
	Token      string    `gorm:"-"                                  json:"token,omitempty"`
}

func SetUserData

func SetUserData(Name, Email, Password, Gender string) *User

func (User) TableName

func (User) TableName() string

type UserLoginForm

type UserLoginForm struct {
	Email    string `form:"email"    validate:"required,max=100,email" json:"email"`
	Password string `form:"password" validate:"required,max=100"       json:"-"`
}

type UserRegisterForm

type UserRegisterForm struct {
	Name     string `form:"name"     validate:"required,max=100"                  json:"name"`
	Email    string `form:"email"    validate:"required,max=100,email"            json:"email"`
	Password string `form:"password" validate:"required,max=100"                  json:"-"`
	Confirm  string `form:"confirm"  validate:"required,max=100,eqfield=Password" json:"-"`
	Gender   string `form:"gender"   validate:"required,oneof=male female"        json:"gender"`
}

type UserToken

type UserToken struct {
	ID        uint      `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	UserID    uint      `gorm:"column:user_id"                     json:"name"`
	Method    string    `gorm:"column:method"                      json:"method"`
	Token     string    `gorm:"column:token"                       json:"-"`
	Expired   time.Time `gorm:"column:expired"                     json:"expired"`
	CreatedAt time.Time `gorm:"column:created_at"                  json:"-"`
	UpdatedAt time.Time `gorm:"column:updated_at"                  json:"-"`
}

func (UserToken) TableName

func (UserToken) TableName() string

type UserUpdateProfileForm

type UserUpdateProfileForm struct {
	Name   string `form:"name"     validate:"required,max=100"                  json:"name"`
	Email  string `form:"email"    validate:"required,max=100,email" json:"email"`
	Gender string `form:"gender"   validate:"required,oneof=male female"        json:"gender"`
}

Jump to

Keyboard shortcuts

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