model

package
v0.0.0-...-a2ad5e3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUBLIC = iota + 1
	SECRET
	DRAFT
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	gorm.Model
	Content string `gorm:"type:varchar(200);comment:网站公告" json:"content"`
}

type Article

type Article struct {
	gorm.Model
	CategoryID int    `gorm:"type:int;not null;comment:分类id" json:"category_id"`
	UserID     int    `gorm:"type:int;not null;comment:作者ID" json:"user_id"`
	Title      string `gorm:"type:varchar(50);not null;comment:文章标题" json:"title"`
	Desc       string `gorm:"type:varchar(150);comment:文章简述" json:"desc"`
	Img        string `gorm:"type:varchar(200);comment:文章配图" json:"img"`
	Views      int    `gorm:"type:int;not null;default:0;comment:浏览量" json:"views"`
	Like       int    `gorm:"type:int;not null; default:0;comment:赞" json:"like"`
	// Tag        string `gorm:"type:varchar(20);comment:标签" json:"tag"`
	Content  string `gorm:"type:longtext;comment:文章内容" json:"content"`
	Status   int8   `gorm:"type:tinyint;comment:状态(1:公开 2:私密 3:草稿)" json:"status"`
	Istop    bool   `gorm:"type:bool;default:false;comment:是否置顶(1:置顶 0:不置顶)" json:"is_top"`
	IsDelete bool   `gorm:"type:bool;default:false;comment:是否软删除(1:是 0:否)" json:"is_delete"`
}

文章

type ArticleComment

type ArticleComment struct {
	Comment
	BelongToArticleID int  `gorm:"type:int;comment:所属文章id" json:"belong_to_article_id"`
	Istop             bool `gorm:"type:bool;default:false;comment:是否置顶(0:否 1:是)" json:"is_top"`
}

一级评论

type ArticleToTag

type ArticleToTag struct {
	ArticleID int `gorm:"type:int;comment:文章id;index:article_to_tag" json:"article_id"`
	TagID     int `gorm:"type:int;comment:标签id;index:article_to_tag" json:"tag_id"`
}

Tag与Article关联表

type BlackList

type BlackList struct {
	gorm.Model
	Adder   int `gorm:"type:int;comment:添加者" json:"adder"`
	BeAdded int `gorm:"type:int;comment:被添加者" json:"be_added"`
}

黑名单

type Category

type Category struct {
	gorm.Model
	Name   string `gorm:"type:varchar(20);not null;comment:分类名称" json:"name"`
	Status int8   `gorm:"type:tinyint;comment:标签状态(0:删除 1:正常)" json:"status"`
}

分类

type ChildComment

type ChildComment struct {
	Comment
	BelongToParentID int `gorm:"type:int;comment:所属父评论ID" json:"belog_to_parent_id"`
	BelongToReplyID  int `gorm:"type:int;comment:所属回复ID" json:"belong_to_reply_id"`
}

子评论和回复

type Collections

type Collections struct {
	gorm.Model
	ArticleID int `gorm:"type:int;comment:收藏文章id" json:"article_id"`
	Collector int `gorm:"type:int;comment:收藏者" json:"collector"`
}

收藏

type Comment

type Comment struct {
	gorm.Model
	UserID  int    `gorm:"type:int;not null;comment:评论用户id" json:"user_id"`
	Content string `gorm:"type:varchar(300);not null;comment:评论内容" json:"content"`
	Status  int8   `gorm:"type:tinyint;default:1;comment:评论状态(1:正常 2:删除 3:审核中)" json:"status"`
	Like    int    `gorm:"type:int;default:0;comment:赞" json:"like"`
	Dislike int    `gorm:"type:int;default:0;comment:踩" json:"dislike"`
}

评论

type Message

type Message struct {
	gorm.Model
	Nickname string `gorm:"type:varchar(15);not null;comment:昵称" json:"nick_name"`
	Content  string `gorm:"type:varchar(200);not null;comment:留言内容" json:"content"`
}

留言

type Notice

type Notice struct {
	gorm.Model
	SenderID      int    `gorm:"type:int;comment:发送者id" json:"sender_id"`
	ReceiverID    int    `gorm:"type:int;comment:接收者id" json:"receiver_id"`
	Content       string `gorm:"type:varchar(300);comment:通知内容" json:"content"`
	ReplyParentID int    `gorm:"type:int;comment:回复的父评论id" json:"reply_parent_id"`
	ReplyChildID  int    `gorm:"type:int;comment:回复的子评论id" json:"reply_child_id"`
}

通知

type Siteinfo

type Siteinfo struct {
	ID     int    `gorm:"primaryKey" json:"id"`
	Name   string `gorm:"type:varchar(20);comment:站长姓名" json:"name"`
	Desc   string `gorm:"type:varchar(200);comment:站长简介" json:"desc"`
	Wechat string `gorm:"type:varchar(100);comment:站长微信" json:"wechat"`
	Weibo  string `gorm:"type:varchar(200);comment:站长微博" json:"weibo"`
	Bili   string `gorm:"type:varchar(200);comment:站长哔哩哔哩" json:"bili"`
	Avatar string `gorm:"type:varchar(200);comment:站长头像" json:"avatar"`
}

type Tag

type Tag struct {
	gorm.Model
	Name string `gorm:"type:varchar(20);comment:标签名" json:"name"`
}

标签

type User

type User struct {
	gorm.Model
	Username  string `gorm:"type:varchar(30);comment:用户名" json:"username"`
	Gender    string `gorm:"type:varchar(10);comment:性别" json:"gender"`
	Password  string `gorm:"type:varchar(20);comment:密码" json:"password"`
	Email     string `gorm:"type:varchar(25);comment:邮箱" json:"email"`
	Avatar    string `gorm:"type:varchar(200);comment:头像" json:"avatar"`
	Info      string `gorm:"type:varchar(200);comment:个人简介" json:"info"`
	IsDisable bool   `gorm:"type:bool;default:false;comment:是否被禁(0:否 1:是)" json:"is_disable"`
}

用户

Jump to

Keyboard shortcuts

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