Documentation
¶
Index ¶
- func ClearDefaultByProjectId(projectId uint64) int64
- func Create(entity *Entity) int64
- func ExistsBySlugAndProjectId(slug string, projectId uint64) bool
- func ExistsBySlugAndProjectIdExcludeId(slug string, projectId uint64, excludeId uint64) bool
- func HasDocuments(versionId uint64) bool
- func Save(entity *Entity) int64
- func SaveOrCreateById(entity *Entity) int64
- func SoftDelete(entity *Entity) int64
- type DirectoryItem
- type Entity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDefaultByProjectId ¶
ClearDefaultByProjectId 清除项目下的默认版本标记
func ExistsBySlugAndProjectId ¶
ExistsBySlugAndProjectId 检查项目下slug是否存在
func ExistsBySlugAndProjectIdExcludeId ¶
ExistsBySlugAndProjectIdExcludeId 检查项目下slug是否存在(排除指定ID)
func SaveOrCreateById ¶
Types ¶
type DirectoryItem ¶
type DirectoryItem struct {
Id uint64 `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
Description string `json:"description,omitempty"`
Children []DirectoryItem `json:"children,omitempty"`
}
DirectoryItem 目录项结构
func BuildSafeDescription ¶
func BuildSafeDescription(tree []DirectoryItem, contentList []DirectoryItem) []DirectoryItem
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` // 版本ID
ProjectId uint64 `gorm:"column:project_id;type:bigint;not null;" json:"projectId"` // 项目ID
Name string `gorm:"column:name;type:varchar(50);not null;default:'';" json:"name"` // 版本名称
Slug string `gorm:"column:slug;type:varchar(50);not null;default:'';" json:"slug"` // 版本标识符
Description string `gorm:"column:description;type:text;" json:"description"` // 版本描述
Status int8 `gorm:"column:status;type:tinyint;not null;default:1;" json:"status"` // 状态(1:活跃 2:维护 3:废弃)
IsDefault int8 `gorm:"column:is_default;type:tinyint;not null;default:0;" json:"isDefault"` // 是否默认版本(0:否 1:是)
IsPublished int8 `gorm:"column:is_published;type:tinyint;not null;default:0;" json:"isPublished"` // 是否发布(0:草稿 1:已发布)
SortOrder int `gorm:"column:sort_order;type:int;not null;default:0;" json:"sortOrder"` // 排序权重
Directory []DirectoryItem `gorm:"column:directory;type:text;serializer:json" json:"directory"`
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"` // 更新时间
DeletedAt gorm.DeletedAt
}
func GetVersionByProject ¶
Click to show internal directories.
Click to hide internal directories.