This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/models/tag.go

40 lines
730 B
Go
Raw Normal View History

package models
// Tag models
type Tag struct {
Name string `gorm:"primaryKey"`
Type TagType `gorm:"column:tag_type"`
Aliases []TagAlias `gorm:"foreignKey:TagID"`
Groups []TagGroup `gorm:"foreignKey:TagID"`
Posts []Post `gorm:"many2many:post_tags;"`
}
func (Tag) TableName() string {
return "Tag"
}
// TagAlias model
type TagAlias struct {
Name string `gorm:"primaryKey"`
TagID string
}
func (TagAlias) TableName() string {
return "TagAlias"
}
// TagGroup model
type TagGroup struct {
Name string `gorm:"primaryKey"`
TagID string
}
func (TagGroup) TableName() string {
return "TagGroup"
}
type TagsWithFrequency struct {
Frequency int64 `json:"frequency"`
Tags Tag `json:"tags"`
}