model

package
v0.0.0-...-69154b6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DictTypeText        = "text"
	DictTypeTextArea    = "textarea"
	DictTypeSelect      = "select" // 格式为 key:value,key:value
	DictTypeUploadImage = "uploadImage"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	orm.Model
	Nickname   string `gorm:"type:varchar(60)" json:"nickname"`
	Username   string `gorm:"type:varchar(60);unique_index" json:"username"`
	Password   string `gorm:"size:64;not null" json:"-"`
	Background string `json:"background"`
	Resume     string `gorm:"type:varchar(140)" json:"resume"`
	Avatar     string `gorm:"type:varchar(200)" json:"avatar"`
	RoleID     uint   `json:"role_id"`
	Token      string `gorm:"-" json:"token"`
	Role       *Role  `gorm:"-" json:"role"`
	IsSelf     bool   `gorm:"-" json:"is_self"`
}

type Article

type Article struct {
	orm.Model
	Title          string        `json:"title"`
	SEOTitle       string        `json:"seo_title"`
	SEODescription string        `json:"seo_description"`
	SEOKeyword     string        `json:"seo_keyword"`
	CategoryID     uint          `json:"category_id"`
	Description    string        `json:"description"`   // article description
	Cover          string        `json:"cover"`         // conver image
	ContentTable   string        `json:"content_table"` // content table
	ContentID      uint          `json:"content_id"`    // content id
	PublishTime    *time.Time    `json:"publish_time"`  // timing publish
	Status         ArticleStatus `json:"status"`        // status
	Views          int           `json:"views"`         // page view count
	Tags           string        `json:"tags"`          // article tags
	AuthorID       uint          `json:"author"`        // article author
	Template       string        `json:"template"`      // 页面渲染模板
	Visibility     uint          `json:"visibility"`    // 可见性 [1. public, 2. private]
	CreatorID      uint          `json:"creator_id"`    // 创建人
	EditorID       uint          `json:"editor_id"`     // 修改人
	AuthorName     string        `gorm:"-" json:"author_name"`
	CategoryName   string        `gorm:"-" json:"category_name"`
}
func (s *Article) Link() string

type ArticleContent

type ArticleContent struct {
	orm.Model
	Markdown string `gorm:"type:text" json:"markdown"`
	Html     string `gorm:"type:text" json:"html"`
}

type ArticlePublish

type ArticlePublish struct {
	Article        *Article
	Tags           []*Tag
	Content        *ArticleContent
	GetCover       bool `json:"get_cover"`
	GetNetImage    bool `json:"get_net_image"`
	GetDescription bool `json:"get_description"`
}

type ArticleStatus

type ArticleStatus int
const (
	ArticleStatusPublish ArticleStatus = 1
	ArticleStatusDraft   ArticleStatus = 2
)

type Category

type Category struct {
	orm.Model
	Name         string      `json:"name"`
	Path         string      `json:"path"`
	SEOTitle     string      `json:"seo_title"`
	Description  string      `json:"description"`
	Keyword      string      `json:"keyword"`
	Remark       string      `json:"remark"`
	Icon         string      `json:"icon"`
	ParentId     uint        `json:"parent_id"`
	Sort         int         `json:"sort"`
	ArticleCount int         `json:"article_count"`
	Children     interface{} `gorm:"-" json:"children"`
}

type Dict

type Dict struct {
	orm.Model
	Key         string   `json:"key"`         // 唯一Key
	Name        string   `json:"name"`        // 名称
	Description string   `json:"description"` // 描述
	Type        DictType `json:"type"`        // 数据类型
	Options     string   `json:"options"`     // 选项
	Value       string   `json:"value"`       // 值
	ReadOnly    bool     `json:"read_only"`   // 是否只读
	Visible     bool     `json:"visible"`     // 是否可见
}

type DictType

type DictType string

type Permission

type Permission struct {
	orm.Model
	Code           string        `json:"code"`            // 唯一识别码
	PermissionName string        `json:"permission_name"` // 权限名称
	PID            uint          `json:"pid"`             // 上级ID
	Child          []*Permission `gorm:"-" json:"child"`
	Parent         *Permission   `gorm:"-" json:"parent"`
}

type RelRolePermission

type RelRolePermission struct {
	RoleID     uint
	Permission uint
}

type RelTagArticle

type RelTagArticle struct {
	TagID     uint
	ArticleID uint
}

type Role

type Role struct {
	orm.Model
	Code        string                   `gorm:"type:varchar(50);unique_index" json:"code"`
	RoleName    string                   `json:"role_name"`
	IsSuper     bool                     `json:"is_super"`
	Permissions map[string][]*Permission `gorm:"-" json:"permissions"`
}

type Tag

type Tag struct {
	orm.Model
	Name            string `gorm:"unique_index" json:"name"`
	Path            string `gorm:"unique_index" json:"path"`
	Description     string `json:"description"`
	Icon            string `json:"icon"`
	MetaTitle       string `json:"meta_title"`
	MetaDescription string `json:"meta_description"`
	ArticleCount    int    `json:"article_count"`
}

type Upload

type Upload struct {
	orm.Model
	Type string `json:"type"`
	Path string `json:"path"`
	URL  string `json:"url"`
	Size int    `json:"size"`
}

Jump to

Keyboard shortcuts

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