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
852 B
Go
Raw Permalink Normal View History

package models
// Tag models
type Tag struct {
Name string `json:"name" gorm:"primaryKey"`
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 {
Name string `json:"name" gorm:"primaryKey"`
TagID string `json:"tag_id"`
}
func (TagAlias) TableName() string {
return "TagAlias"
}
// TagGroup model
type TagGroup struct {
Name string `json:"name" gorm:"primaryKey"`
TagID string `json:"tag_id"`
}
func (TagGroup) TableName() string {
return "TagGroup"
}
type TagsWithFrequency struct {
Frequency int64 `json:"frequency"`
Tags Tag `json:"tags"`
}