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"`
|
2024-08-13 08:54:21 +00:00
|
|
|
Aliases []TagAlias `json:"aliases,omitempty" gorm:"foreignKey:TagID"`
|
|
|
|
Groups []TagGroup `json:"groups,omitempty" gorm:"foreignKey:TagID"`
|
|
|
|
Posts []Post `json:"posts,omitempty" gorm:"many2many:post_tags;"`
|
2024-07-19 08:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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"`
|
|
|
|
}
|