Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToResponseSlice ¶
Types ¶
type Ban ¶ added in v0.2.7
type Ban struct {
BaseEntity[response.BanResponse]
Id uint `gorm:"primaryKey"`
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"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}
func (Ban) ToResponse ¶ added in v0.2.7
func (b Ban) ToResponse() (*response.BanResponse, error)
type BaseEntity ¶
type BaseEntity[E any] struct { RespInstance *E `gorm:"-"` }
func (*BaseEntity[E]) CopyToResponse ¶
func (b *BaseEntity[E]) CopyToResponse(source any) (*E, error)
type Image ¶
type Image struct {
BaseEntity[response.ImageResponse]
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) ToResponse ¶
func (a Image) ToResponse() (*response.ImageResponse, error)
type Role ¶
type Role struct {
BaseEntity[response.RoleResponse]
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) ToResponse ¶
func (r Role) ToResponse() (*response.RoleResponse, error)
type User ¶
type User struct {
BaseEntity[response.UserResponse]
Id uint `gorm:"primaryKey"`
Username string `gorm:"unique;not null"`
Email string `gorm:"unique;not null" query:"ops:ilike|like|eq|neq"`
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) ToResponse ¶
func (u User) ToResponse() (*response.UserResponse, error)
Click to show internal directories.
Click to hide internal directories.