entities

package
v0.0.0-...-bd5dacb Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PasswordResets

type PasswordResets struct {
	UserID    string    `json:"user_id" xml:"user_id" form:"user_id" gorm:"primaryKey" validate:"required,uuid"`
	Token     string    `json:"token" xml:"token" form:"token" gorm:"size:36;not null" validate:"required,uuid"`
	ExpiredAt time.Time `json:"expired_at" xml:"expired_at" gorm:"not null" form:"expired_at"`
}

PasswordResets is used to reset user password.

type Task

type Task struct {
	ID          string         `json:"id" xml:"id" form:"id" gorm:"primaryKey"`
	Name        string         `json:"name" xml:"name" form:"not null;name" gorm:"size:127" validate:"required,min=3,max=127"`
	Description string         `json:"description" xml:"description" form:"description" gorm:"size:127"`
	CreatedAt   time.Time      `json:"created_at" xml:"created_at" form:"created_at" gorm:"not null;autoCreateTime"`
	UpdatedAt   time.Time      `json:"updated_at" xml:"updated_at" form:"updated_at" gorm:"not null;autoUpdateTime"`
	DeletedAt   gorm.DeletedAt `json:"-" xml:"-" form:"deleted_at" gorm:"index"`
}

Task represents a task in database.

type User

type User struct {
	ID            string         `json:"id" xml:"id" form:"id" gorm:"primaryKey" validate:"required,uuid"`
	Username      string         `json:"username" xml:"username" form:"username" gorm:"not null;unique;size:127" validate:"required,email"`
	Password      string         `json:"-" xml:"-" form:"password" gorm:"not null;index;size:128" validate:"required,min=8"` // SHA512
	Lastname      string         `json:"lastname" xml:"lastname" form:"lastname" gorm:"size:63" validate:"required"`
	Firstname     string         `json:"firstname" xml:"firstname" form:"firstname" gorm:"size:63" validate:"required"`
	CreatedAt     time.Time      `json:"created_at" xml:"created_at" form:"created_at" gorm:"not null;autoCreateTime"`
	UpdatedAt     time.Time      `json:"updated_at" xml:"updated_at" form:"updated_at" gorm:"not null;autoUpdateTime"`
	DeletedAt     gorm.DeletedAt `json:"-" xml:"-" form:"deleted_at" gorm:"index"`
	PasswordReset PasswordResets `json:"-" xml:"-" form:"-" gorm:"constraint:OnDelete:CASCADE"`
}

User represents a user in database.

func (*User) GenerateJWT

func (u *User) GenerateJWT(lifetime time.Duration, algo, secret string) (string, time.Time, error)

GenerateJWT returns a token

Jump to

Keyboard shortcuts

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