model

package
v0.0.0-...-1bbc35f Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 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 Session

type Session struct {
	// JwtID is the ID of the refresh token.
	JwtID string
	// RefreshToken is the refresh token.
	RefreshToken string
	// ExpirationTime is the expiration time of the refresh token.
	ExpirationTime time.Duration
}

Session represents a user session. This should be stored in K/V database like Redis.

type User

type User struct {
	Email    string `json:"email"    validate:"required"`
	Password string `json:"password" validate:"required"`
}

func (*User) Validate

func (u *User) Validate() error

type UserDB

type UserDB struct {
	ID           uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	Email        string    `gorm:"unique;not null;check:length(email) > 0"`
	PasswordHash string    `gorm:"not null"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    gorm.DeletedAt `gorm:"index"`
}

func (UserDB) TableName

func (UserDB) TableName() string

Jump to

Keyboard shortcuts

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