utilitymodels

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: GPL-2.0 Imports: 3 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

type CommonID

type CommonID struct {
	ID uint `gorm:"primarykey" json:"id"`
}

type CommonSoftDelete

type CommonSoftDelete struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type Session

type Session struct {
	Common
	UserID     uint      `json:"user_id" gorm:"not null"`
	User       User      `json:"user" gorm:"not null;constraint:OnDelete:CASCADE"`
	SessionID  string    `json:"-" gorm:"not null;unique"`
	ValidUntil time.Time `json:"valid_until" gorm:"not null"`
}

type User

type User struct {
	Common
	LastLoginAt sql.NullTime `json:"-" gorm:"default:null"` // This is only relevant if the session middleware is in use
	Email       *string      `json:"email" gorm:"unique;default:null"`
	Username    string       `json:"username" gorm:"unique;not null"`
	Password    string       `json:"-" gorm:"not null"`
	Active      sql.NullBool `json:"active" gorm:"default:true"`
}

Jump to

Keyboard shortcuts

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