models

package
v0.0.0-...-c91a537 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Token     string    `gorm:"type:varchar(1024);primary_key"`
	UserId    uuid.UUID `gorm:"not null;index"`
	User      User      `gorm:"constraint:OnDelete:CASCADE"`
	CreatedAt time.Time
	ExpiresAt time.Time
}

func (*AccessToken) TableName

func (*AccessToken) TableName() string

type ResetToken

type ResetToken struct {
	Token     string    `gorm:"type:varchar(1024);primary_key"`
	UserId    uuid.UUID `gorm:"not null;index"`
	User      User      `gorm:"constraint:OnDelete:CASCADE"`
	CreatedAt time.Time
	ExpiresAt time.Time
}

func (*ResetToken) TableName

func (*ResetToken) TableName() string

type Scope

type Scope struct {
	ID   uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	Name string    `gorm:"type:varchar(120);unique;not null"`
}

func (*Scope) TableName

func (*Scope) TableName() string

type User

type User struct {
	ID             uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	Email          string    `gorm:"type:varchar(320);unique;not null"`
	HashedPassword string    `gorm:"type:varchar(1024);not null"`
	FirstName      string    `gorm:"type:varchar(120);not null"`
	LastName       string    `gorm:"type:varchar(120);not null"`
	UserTypeId     uuid.UUID `gorm:"not null"`
	UserType       UserType
	IsActive       bool `gorm:"type:boolean;not null;default:true"`
	IsVerified     bool `gorm:"type:boolean;not null;default:false"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*User) AfterUpdate

func (u *User) AfterUpdate(tx *gorm.DB) (err error)

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(tx *gorm.DB) (err error)

func (*User) SetPassword

func (u *User) SetPassword(password string) error

func (*User) TableName

func (*User) TableName() string

func (*User) Validate

func (u *User) Validate() error

func (*User) VerifyPassword

func (u *User) VerifyPassword(password string) bool

type UserType

type UserType struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	Name      string    `gorm:"type:varchar(120);unique;not null"`
	IsDefault bool      `gorm:"type:boolean;not null;default:false"`
	Scopes    []Scope   `gorm:"many2many:auth_user_type_scopes;"`
}

func (*UserType) ScopeNames

func (u *UserType) ScopeNames() []string

func (*UserType) TableName

func (*UserType) TableName() string

type UserValidateError

type UserValidateError struct {
	Message string
}

func (*UserValidateError) Error

func (e *UserValidateError) Error() string

type VerifyToken

type VerifyToken struct {
	Token     string    `gorm:"type:varchar(1024);primary_key"`
	UserId    uuid.UUID `gorm:"not null;index"`
	User      User      `gorm:"constraint:OnDelete:CASCADE"`
	CreatedAt time.Time
	ExpiresAt time.Time
}

func (*VerifyToken) TableName

func (*VerifyToken) TableName() string

Jump to

Keyboard shortcuts

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