entities

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ban added in v0.2.7

type Ban struct {
	Id          uint   `gorm:"primaryKey" query:"unique"`
	UserId      uint   `gorm:"not null"`
	User        User   `gorm:"foreignKey:UserId;constraint:OnDelete:CASCADE"`
	Reason      string `gorm:"type:text"`
	IsPermanent bool   `gorm:"not null;default:false"`
	UnbanDate   *time.Time
	IsActive    bool      `gorm:"not null;default:true"`
	CreatedAt   time.Time `gorm:"default:CURRENT_TIMESTAMP" query:"unique"`
	UpdatedAt   time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

func (Ban) MarkerEntity added in v0.2.10

func (b Ban) MarkerEntity()

type Entity

type Entity interface {
	MarkerEntity()
}

type Image

type Image struct {
	Id        uint      `gorm:"primaryKey"`
	S3Key     string    `gorm:"size:255;not null"`
	Url       string    `gorm:"size:512;not null"`
	UserID    *uint     `gorm:"index"` // Указатель для nullable
	Size      int       `gorm:""`
	MimeType  string    `gorm:"size:50"`
	ExpiresAt time.Time `gorm:""`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

func (Image) MarkerEntity added in v0.2.10

func (b Image) MarkerEntity()

type Role

type Role struct {
	Id          uint               `gorm:"primaryKey" query:"unique"`
	Name        role_enum.RoleName `gorm:"unique;not null" query:"unique"`
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (Role) MarkerEntity added in v0.2.10

func (r Role) MarkerEntity()

type User

type User struct {
	Id           uint   `gorm:"primaryKey" query:"unique"`
	Username     string `gorm:"unique;not null" query:"unique"`
	Email        string `gorm:"unique;not null" query:"ops:ilike|like|eq|neq,unique"`
	PasswordHash string `gorm:"not null" query:"ignore"`
	FirstName    string
	LastName     string
	RoleId       uint
	IsBanned     bool  `gorm:"default:false"`
	Bans         []Ban `gorm:"foreignKey:UserId"`
	Role         Role  `gorm:"foreignKey:RoleId"`
	IsActive     bool  `gorm:"default:true"`
	LastLogin    *time.Time
	CreatedAt    time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	UpdatedAt    time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

func (User) MarkerEntity added in v0.2.10

func (user User) MarkerEntity()

Jump to

Keyboard shortcuts

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