Documentation
¶
Index ¶
Constants ¶
const TableNameAttachment = "attachment"
const TableNameCategory = "category"
const TableNameComment = "comment"
const TableNameCommentBlack = "comment_black"
const TableNameFlywaySchemaHistory = "flyway_schema_history"
const TableNameJournal = "journal"
const TableNameLink = "link"
const TableNameLog = "log"
const TableNameMenu = "menu"
const TableNameMeta = "meta"
const TableNameOption = "option"
const TableNamePhoto = "photo"
const TableNamePost = "post"
const TableNamePostCategory = "post_category"
const TableNamePostTag = "post_tag"
const TableNameTag = "tag"
const TableNameThemeSetting = "theme_setting"
const TableNameUser = "user"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null;index:attachment_create_time,priority:1" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
FileKey string `gorm:"column:file_key;type:varchar(2047);not null" json:"file_key"`
Height int32 `gorm:"column:height;type:int;not null" json:"height"`
MediaType string `gorm:"column:media_type;type:varchar(127);not null;index:attachment_media_type,priority:1" json:"media_type"`
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
Path string `gorm:"column:path;type:varchar(1023);not null" json:"path"`
Size int64 `gorm:"column:size;type:bigint;not null" json:"size"`
Suffix string `gorm:"column:suffix;type:varchar(50);not null" json:"suffix"`
ThumbPath string `gorm:"column:thumb_path;type:varchar(1023);not null" json:"thumb_path"`
Type consts.AttachmentType `gorm:"column:type;type:bigint;not null" json:"type"`
Width int32 `gorm:"column:width;type:int;not null" json:"width"`
}
Attachment mapped from table <attachment>
func (*Attachment) BeforeCreate ¶
func (m *Attachment) BeforeCreate(tx *gorm.DB) (err error)
func (*Attachment) BeforeUpdate ¶
func (m *Attachment) BeforeUpdate(tx *gorm.DB) (err error)
func (*Attachment) TableName ¶
func (*Attachment) TableName() string
TableName Attachment's table name
type Category ¶
type Category struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Description string `gorm:"column:description;type:varchar(100);not null" json:"description"`
Type consts.CategoryType `gorm:"column:type;type:tinyint;not null" json:"type"`
Name string `gorm:"column:name;type:varchar(255);not null;index:category_name,priority:1" json:"name"`
ParentID int32 `gorm:"column:parent_id;type:int;not null;index:category_parent_id,priority:1" json:"parent_id"`
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"`
Slug string `gorm:"column:slug;type:varchar(255);not null;uniqueIndex:uniq_category_slug,priority:1" json:"slug"`
Thumbnail string `gorm:"column:thumbnail;type:varchar(1023);not null" json:"thumbnail"`
Priority int32 `gorm:"column:priority;type:int;not null" json:"priority"`
}
Category mapped from table <category>
type Comment ¶
type Comment struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
Type consts.CommentType `gorm:"column:type;type:bigint;not null;index:comment_type_status,priority:1" json:"type"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
AllowNotification bool `gorm:"column:allow_notification;type:tinyint(1);not null;default:1" json:"allow_notification"`
Author string `gorm:"column:author;type:varchar(50);not null" json:"author"`
AuthorURL string `gorm:"column:author_url;type:varchar(511);not null" json:"author_url"`
Content string `gorm:"column:content;type:varchar(1023);not null" json:"content"`
Email string `gorm:"column:email;type:varchar(255);not null" json:"email"`
GravatarMd5 string `gorm:"column:gravatar_md5;type:varchar(127);not null" json:"gravatar_md5"`
IPAddress string `gorm:"column:ip_address;type:varchar(127);not null" json:"ip_address"`
IsAdmin bool `gorm:"column:is_admin;type:tinyint(1);not null" json:"is_admin"`
ParentID int32 `gorm:"column:parent_id;type:int;not null;index:comment_parent_id,priority:1" json:"parent_id"`
PostID int32 `gorm:"column:post_id;type:int;not null;index:comment_post_id,priority:1" json:"post_id"`
Status consts.CommentStatus `gorm:"column:status;type:bigint;not null;index:comment_type_status,priority:2" json:"status"`
TopPriority int32 `gorm:"column:top_priority;type:int;not null" json:"top_priority"`
UserAgent string `gorm:"column:user_agent;type:varchar(511);not null" json:"user_agent"`
Likes int32 `gorm:"column:likes;type:int;not null;default: 0" json:"likes"`
}
Comment mapped from table <comment>
type CommentBlack ¶
type CommentBlack struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
BanTime time.Time `gorm:"column:ban_time;type:datetime;not null" json:"ban_time"`
IPAddress string `gorm:"column:ip_address;type:varchar(127);not null" json:"ip_address"`
}
CommentBlack mapped from table <comment_black>
func (*CommentBlack) BeforeCreate ¶
func (m *CommentBlack) BeforeCreate(tx *gorm.DB) (err error)
func (*CommentBlack) BeforeUpdate ¶
func (m *CommentBlack) BeforeUpdate(tx *gorm.DB) (err error)
func (*CommentBlack) TableName ¶
func (*CommentBlack) TableName() string
TableName CommentBlack's table name
type FlywaySchemaHistory ¶
type FlywaySchemaHistory struct {
InstalledRank int32 `gorm:"column:installed_rank;type:int;primaryKey" json:"installed_rank"`
Version *string `gorm:"column:version;type:varchar(50)" json:"version"`
Description string `gorm:"column:description;type:varchar(200);not null" json:"description"`
Type string `gorm:"column:type;type:varchar(20);not null" json:"type"`
Script string `gorm:"column:script;type:varchar(1000);not null" json:"script"`
Checksum *int32 `gorm:"column:checksum;type:int" json:"checksum"`
InstalledBy string `gorm:"column:installed_by;type:varchar(100);not null" json:"installed_by"`
InstalledOn time.Time `gorm:"column:installed_on;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"installed_on"`
ExecutionTime int32 `gorm:"column:execution_time;type:int;not null" json:"execution_time"`
Success bool `gorm:"column:success;type:tinyint(1);not null;index:flyway_schema_history_s_idx,priority:1" json:"success"`
}
FlywaySchemaHistory mapped from table <flyway_schema_history>
func (*FlywaySchemaHistory) TableName ¶
func (*FlywaySchemaHistory) TableName() string
TableName FlywaySchemaHistory's table name
type Journal ¶
type Journal struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Content string `gorm:"column:content;type:text;not null" json:"content"`
Likes int64 `gorm:"column:likes;type:bigint;not null" json:"likes"`
SourceContent string `gorm:"column:source_content;type:longtext;not null" json:"source_content"`
Type consts.JournalType `gorm:"column:type;type:bigint;not null" json:"type"`
}
Journal mapped from table <journal>
type Link ¶
type Link struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Description string `gorm:"column:description;type:varchar(255);not null" json:"description"`
Logo string `gorm:"column:logo;type:varchar(1023);not null" json:"logo"`
Name string `gorm:"column:name;type:varchar(255);not null;index:link_name,priority:1" json:"name"`
Priority int32 `gorm:"column:priority;type:int;not null" json:"priority"`
Team string `gorm:"column:team;type:varchar(255);not null" json:"team"`
URL string `gorm:"column:url;type:varchar(1023);not null" json:"url"`
}
Link mapped from table <link>
type Log ¶
type Log struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null;index:log_create_time,priority:1" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Content string `gorm:"column:content;type:varchar(1023);not null" json:"content"`
IPAddress string `gorm:"column:ip_address;type:varchar(127);not null" json:"ip_address"`
LogKey string `gorm:"column:log_key;type:varchar(1023);not null" json:"log_key"`
Type consts.LogType `gorm:"column:type;type:bigint;not null" json:"type"`
}
Log mapped from table <log>
type Menu ¶
type Menu struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Icon string `gorm:"column:icon;type:varchar(50);not null" json:"icon"`
Name string `gorm:"column:name;type:varchar(50);not null;index:menu_name,priority:1" json:"name"`
ParentID int32 `gorm:"column:parent_id;type:int;not null;index:menu_parent_id,priority:1" json:"parent_id"`
Priority int32 `gorm:"column:priority;type:int;not null" json:"priority"`
Target string `gorm:"column:target;type:varchar(20);not null;default:_self" json:"target"`
Team string `gorm:"column:team;type:varchar(255);not null" json:"team"`
URL string `gorm:"column:url;type:varchar(1023);not null" json:"url"`
}
Menu mapped from table <menu>
type Meta ¶
type Meta struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
Type consts.MetaType `gorm:"column:type;type:bigint;not null" json:"type"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
MetaKey string `gorm:"column:meta_key;type:varchar(255);not null" json:"meta_key"`
PostID int32 `gorm:"column:post_id;type:int;not null" json:"post_id"`
MetaValue string `gorm:"column:meta_value;type:varchar(1023);not null" json:"meta_value"`
}
Meta mapped from table <meta>
type Option ¶
type Option struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
OptionKey string `gorm:"column:option_key;type:varchar(100);not null" json:"option_key"`
Type consts.OptionType `gorm:"column:type;type:bigint;not null" json:"type"`
OptionValue string `gorm:"column:option_value;type:longtext;not null" json:"option_value"`
}
Option mapped from table <option>
type Photo ¶
type Photo struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null;index:photo_create_time,priority:1" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Description string `gorm:"column:description;type:varchar(255);not null" json:"description"`
Location string `gorm:"column:location;type:varchar(255);not null" json:"location"`
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
TakeTime *time.Time `gorm:"column:take_time;type:datetime" json:"take_time"`
Team string `gorm:"column:team;type:varchar(255);not null;index:photo_team,priority:1" json:"team"`
Thumbnail string `gorm:"column:thumbnail;type:varchar(1023);not null" json:"thumbnail"`
URL string `gorm:"column:url;type:varchar(1023);not null" json:"url"`
Likes int64 `gorm:"column:likes;type:bigint;not null" json:"likes"`
}
Photo mapped from table <photo>
type Post ¶
type Post struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
Type consts.PostType `gorm:"column:type;type:bigint;not null;index:post_type_status,priority:1" json:"type"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null;index:post_create_time,priority:1" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
DisallowComment bool `gorm:"column:disallow_comment;type:tinyint(1);not null" json:"disallow_comment"`
EditTime *time.Time `gorm:"column:edit_time;type:datetime" json:"edit_time"`
EditorType consts.EditorType `gorm:"column:editor_type;type:bigint;not null" json:"editor_type"`
FormatContent string `gorm:"column:format_content;type:longtext;not null" json:"format_content"`
Likes int64 `gorm:"column:likes;type:bigint;not null" json:"likes"`
MetaDescription string `gorm:"column:meta_description;type:varchar(1023);not null" json:"meta_description"`
MetaKeywords string `gorm:"column:meta_keywords;type:varchar(511);not null" json:"meta_keywords"`
OriginalContent string `gorm:"column:original_content;type:longtext;not null" json:"original_content"`
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"`
Slug string `gorm:"column:slug;type:varchar(255);not null;uniqueIndex:uniq_post_slug,priority:1" json:"slug"`
Status consts.PostStatus `gorm:"column:status;type:bigint;not null;index:post_type_status,priority:2;default:1" json:"status"`
Summary string `gorm:"column:summary;type:longtext;not null" json:"summary"`
Template string `gorm:"column:template;type:varchar(255);not null" json:"template"`
Thumbnail string `gorm:"column:thumbnail;type:varchar(1023);not null" json:"thumbnail"`
Title string `gorm:"column:title;type:varchar(255);not null" json:"title"`
TopPriority int32 `gorm:"column:top_priority;type:int;not null" json:"top_priority"`
Visits int64 `gorm:"column:visits;type:bigint;not null" json:"visits"`
WordCount int64 `gorm:"column:word_count;type:bigint;not null" json:"word_count"`
}
Post mapped from table <post>
type PostCategory ¶
type PostCategory struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
CategoryID int32 `gorm:"column:category_id;type:int;not null;index:post_category_category_id,priority:1" json:"category_id"`
PostID int32 `gorm:"column:post_id;type:int;not null;index:post_category_post_id,priority:1" json:"post_id"`
}
PostCategory mapped from table <post_category>
func (*PostCategory) BeforeCreate ¶
func (m *PostCategory) BeforeCreate(tx *gorm.DB) (err error)
func (*PostCategory) BeforeUpdate ¶
func (m *PostCategory) BeforeUpdate(tx *gorm.DB) (err error)
func (*PostCategory) TableName ¶
func (*PostCategory) TableName() string
TableName PostCategory's table name
type PostTag ¶
type PostTag struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
PostID int32 `gorm:"column:post_id;type:int;not null;index:post_tag_post_id,priority:1" json:"post_id"`
TagID int32 `gorm:"column:tag_id;type:int;not null;index:post_tag_tag_id,priority:1" json:"tag_id"`
}
PostTag mapped from table <post_tag>
type Tag ¶
type Tag struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Name string `gorm:"column:name;type:varchar(255);not null;index:tag_name,priority:1" json:"name"`
Slug string `gorm:"column:slug;type:varchar(50);not null;uniqueIndex:uniq_tag_slug,priority:1" json:"slug"`
Thumbnail string `gorm:"column:thumbnail;type:varchar(1023);not null" json:"thumbnail"`
Color string `gorm:"column:color;type:varchar(25);not null" json:"color"`
}
Tag mapped from table <tag>
type ThemeSetting ¶
type ThemeSetting struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
SettingKey string `gorm:"column:setting_key;type:varchar(255);not null;index:theme_setting_setting_key,priority:1" json:"setting_key"`
ThemeID string `gorm:"column:theme_id;type:varchar(255);not null;index:theme_setting_theme_id,priority:1" json:"theme_id"`
SettingValue string `gorm:"column:setting_value;type:longtext;not null" json:"setting_value"`
}
ThemeSetting mapped from table <theme_setting>
func (*ThemeSetting) BeforeCreate ¶
func (m *ThemeSetting) BeforeCreate(tx *gorm.DB) (err error)
func (*ThemeSetting) BeforeUpdate ¶
func (m *ThemeSetting) BeforeUpdate(tx *gorm.DB) (err error)
func (*ThemeSetting) TableName ¶
func (*ThemeSetting) TableName() string
TableName ThemeSetting's table name
type User ¶
type User struct {
ID int32 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time;type:datetime" json:"update_time"`
Avatar string `gorm:"column:avatar;type:varchar(1023);not null" json:"avatar"`
Description string `gorm:"column:description;type:varchar(1023);not null" json:"description"`
Email string `gorm:"column:email;type:varchar(127);not null" json:"email"`
ExpireTime *time.Time `gorm:"column:expire_time;type:datetime" json:"expire_time"`
MfaKey string `gorm:"column:mfa_key;type:varchar(64);not null" json:"mfa_key"`
MfaType consts.MFAType `gorm:"column:mfa_type;type:bigint;not null" json:"mfa_type"`
Nickname string `gorm:"column:nickname;type:varchar(255);not null" json:"nickname"`
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"`
Username string `gorm:"column:username;type:varchar(50);not null" json:"username"`
}
User mapped from table <user>