tag

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_GROUP_NAME = "默认组"
View Source
const DEFAULT_OWNER_TYPE = "default"
View Source
const R_TAG_TO_OJECT_FOREIGN_KEY = "taggable_object_id"
View Source
const R_TAG_TO_OJECT_JOIN_KEY = "tag_id"
View Source
const R_TAG_TO_OJECT_OWNER_KEY = "taggable_owner_type"
View Source
const R_TAG_TO_OJECT_UNIQUE_ID = "index_tag_to_object_id"
View Source
const TABLE_NAME_R_TAG_TO_OBJECT = "r_tag_to_object"
View Source
const TABLE_NAME_TAG = "tags"
View Source
const TABLE_NAME_TAG_GROUP = "tag_groups"
View Source
const TAG_GROUP_UNIQUE_ID = "index_tag_group_id"
View Source
const TAG_TYPE_NORMAL int8 = 1
View Source
const TAG_TYPE_STAGE int8 = 2
View Source
const TAG_UNIQUE_ID = "index_tag_id"

Variables

View Source
var TABLE_FULL_NAME_R_TAG_TO_OBJECT string = "public.ac_" + TABLE_NAME_R_TAG_TO_OBJECT
View Source
var TABLE_FULL_NAME_TAG string = "public.ac_" + TABLE_NAME_TAG
View Source
var TABLE_FULL_NAME_TAG_GROUP = "public.ac_" + TABLE_NAME_TAG_GROUP

Functions

This section is empty.

Types

type RTagToObject

type RTagToObject struct {
	*database.PowerPivot

	//common fields
	UniqueID          object.NullString `gorm:"index:index_taggable_object_id;index:index_taggable_id;index;column:index_tag_to_object_id;unique"`
	TaggableOwnerType object.NullString `gorm:"column:taggable_owner_type;not null" json:"taggableOwnerType"`
	TaggableObjectID  object.NullString `gorm:"column:taggable_object_id;not null;index:index_taggable_object_id" json:"taggableObjectID"`
	TaggableID        object.NullString `gorm:"column:tag_id;not null;index:index_taggable_id" json:"taggableID"`
}

r_tag_to_object 数据表结构

func (*RTagToObject) GetForeignKey

func (mdl *RTagToObject) GetForeignKey() string

func (*RTagToObject) GetForeignValue

func (mdl *RTagToObject) GetForeignValue() string

func (*RTagToObject) GetJoinKey

func (mdl *RTagToObject) GetJoinKey() string

func (*RTagToObject) GetJoinValue

func (mdl *RTagToObject) GetJoinValue() string

func (*RTagToObject) GetOwnerKey

func (mdl *RTagToObject) GetOwnerKey() string

func (*RTagToObject) GetOwnerValue

func (mdl *RTagToObject) GetOwnerValue() string

func (*RTagToObject) GetPivotComposedUniqueID

func (mdl *RTagToObject) GetPivotComposedUniqueID() string

func (*RTagToObject) GetPivots

func (mdl *RTagToObject) GetPivots(db *gorm.DB) ([]*RTagToObject, error)

func (*RTagToObject) GetTableName

func (mdl *RTagToObject) GetTableName(needFull bool) string

func (*RTagToObject) MakePivotsFromObjectAndTags

func (mdl *RTagToObject) MakePivotsFromObjectAndTags(obj database.ModelInterface, tags []*Tag) ([]database.PivotInterface, error)

func (*RTagToObject) SetTableFullName

func (mdl *RTagToObject) SetTableFullName(tableName string)

func (*RTagToObject) TableName

func (mdl *RTagToObject) TableName() string

TableName overrides the table name used by RTagToObject to `profiles`

type Tag

type Tag struct {
	*database.PowerCompactModel

	TagGroup *TagGroup `gorm:"foreignKey:GroupID;references:UniqueID" json:"tagGroup"`

	UniqueID string `gorm:"column:index_tag_id;index:,unique" json:"tagID"`
	Name     string `gorm:"column:name;" json:"name"`
	GroupID  string `gorm:"column:group_id" json:"groupID"`
	Type     int8   `gorm:"column:type" json:"type"`
}

Tag 数据表结构

func NewTag

func NewTag(mapObject *object.Collection) *Tag

func (*Tag) ClearAssociations

func (mdl *Tag) ClearAssociations(db *gorm.DB) (err error)

func (*Tag) GetComposedUniqueID

func (mdl *Tag) GetComposedUniqueID() string

func (*Tag) GetForeignKey

func (mdl *Tag) GetForeignKey() string

func (*Tag) GetTableName

func (mdl *Tag) GetTableName(needFull bool) string

获取当前 Model 的数据库表名称

func (*Tag) GetTagUniqueIDsFromTags

func (mdl *Tag) GetTagUniqueIDsFromTags(tags []*Tag) []string

func (*Tag) SetTableFullName

func (mdl *Tag) SetTableFullName(tableName string)

func (*Tag) TableName

func (mdl *Tag) TableName() string

TableName overrides the table name used by Tag to `profiles`

func (*Tag) WhereTagName

func (mdl *Tag) WhereTagName(uuidOrName string) func(db *gorm.DB) *gorm.DB

通过 UUID 或者 Name 查看tag数据

type TagGroup

type TagGroup struct {
	*database.PowerCompactModel

	Tags []*Tag `gorm:"foreignKey:GroupID;references:UniqueID" json:"tags"`

	UniqueID  string `gorm:"column:index_tag_group_id;index:,unique" json:"tagGroupID"`
	GroupName string `gorm:"column:group_name;index:index_group_name" json:"groupName"`
	OwnerType string `gorm:"column:owner_type;index:index_owner_type" json:"ownerType"`
}

func GetDefaultTagGroup

func GetDefaultTagGroup(db *gorm.DB) (defaultTagGroup *TagGroup, err error)

func NewTagGroup

func NewTagGroup(mapObject *object.Collection) *TagGroup

func (*TagGroup) CheckTagGroupNameAvailable

func (mdl *TagGroup) CheckTagGroupNameAvailable(db *gorm.DB) (err error)

func (*TagGroup) GetComposedUniqueID

func (mdl *TagGroup) GetComposedUniqueID() string

func (*TagGroup) GetTableName

func (mdl *TagGroup) GetTableName(needFull bool) string

获取当前 Model 的数据库表名称

func (*TagGroup) SetTableFullName

func (mdl *TagGroup) SetTableFullName(tableName string)

func (*TagGroup) TableName

func (mdl *TagGroup) TableName() string

TableName overrides the table name used by TagGroup to `profiles`

type TagObjectInterface

type TagObjectInterface interface {
	SetTagUUID(tagUUID string) (err error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL