2024-07-19 08:03:35 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
// Tag models
|
|
|
|
type Tag struct {
|
2024-08-10 22:13:46 +00:00
|
|
|
Name TagName `json:"name" gorm:"primaryKey"`
|
2024-07-19 08:03:35 +00:00
|
|
|
Type TagType `json:"type" gorm:"column:tag_type"`
|
|
|
|
Aliases []TagAlias `json:"aliases" gorm:"foreignKey:TagID"`
|
|
|
|
Groups []TagGroup `json:"groups" gorm:"foreignKey:TagID"`
|
|
|
|
Posts []Post `json:"posts" gorm:"many2many:post_tags;"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Tag) TableName() string {
|
|
|
|
return "Tag"
|
|
|
|
}
|
|
|
|
|
|
|
|
// TagAlias model
|
|
|
|
type TagAlias struct {
|
2024-08-10 22:13:46 +00:00
|
|
|
Name TagAliasName `json:"name" gorm:"primaryKey"`
|
|
|
|
TagID TagName `json:"tag_id"`
|
2024-07-19 08:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (TagAlias) TableName() string {
|
|
|
|
return "TagAlias"
|
|
|
|
}
|
|
|
|
|
|
|
|
// TagGroup model
|
|
|
|
type TagGroup struct {
|
2024-08-10 22:13:46 +00:00
|
|
|
Name TagGroupName `json:"name" gorm:"primaryKey"`
|
|
|
|
TagID TagName `json:"tag_id"`
|
2024-07-19 08:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (TagGroup) TableName() string {
|
|
|
|
return "TagGroup"
|
|
|
|
}
|
|
|
|
|
|
|
|
type TagsWithFrequency struct {
|
|
|
|
Frequency int64 `json:"frequency"`
|
|
|
|
Tags Tag `json:"tags"`
|
|
|
|
}
|