Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Category ¶
type Category struct { gorm.Model ID int `gorm:"primaryKey" json:"id"` Name string `gorm:"size:255" json:"name"` Description string `gorm:"type:text" json:"description"` ParentID *int `gorm:"index;default:NULL" json:"parent_id"` Parent *Category `gorm:"foreignKey:ParentID"` Quotes []Quote `gorm:"many2many:quote_categories"` }
func (*Category) BeforeCreate ¶
Ensure foreign key constraints are applied on migrations.
type Quote ¶
type Quote struct { gorm.Model ID int `gorm:"primaryKey" json:"id"` QText string `gorm:"column:qtext;type:varchar(255);not null" json:"text"` Tags string `gorm:"column:tags;type:varchar(255);not null" json:"tags"` AuthorID *int `json:"author_id"` Author Author `json:"author"` Categories []Category `gorm:"many2many:quote_categories"` UserWhoLiked []User `gorm:"many2many:quote_likes" json:"users_who_liked"` }
func (*Quote) LikedCount ¶
type User ¶
type User struct { gorm.Model ID int `gorm:"primaryKey" json:"id"` Username string `gorm:"unique" json:"username"` Password string `json:"-"` FullName string `json:"name"` Email string `gorm:"unique" json:"email"` Phone string `json:"phone"` Level string `json:"level"` IsActive bool `json:"is_active"` IsSuperuser bool `json:"is_superuser"` LikedQuotes []Quote `gorm:"many2many:quote_likes"` }
Click to show internal directories.
Click to hide internal directories.