model

package
v0.0.0-...-cfa74d8 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModelTableGroup = &TableGroup{
		"main": SystemTableList,
	}
	// SystemTableList
	// @Date: 2023-02-06 22:33:32
	// 系统表
	SystemTableList = []TableMeta{
		SystemUser{},
		Class{},
		File{},

		Article{},
		ArticleComment{},

		Share{},
		ShareComment{},

		Comment{},
		Reply{},
		Like{},
	}
)

Functions

This section is empty.

Types

type Article

type Article struct {
	ArticleMeta
	SystemUser SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	Class      Class      `gorm:"foreignKey:ClassId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	UserId  uint   `gorm:"comment:作者ID;" json:"userid"`
	ClassId uint   `gorm:"comment:分类ID;" json:"classId"`
	Title   string `gorm:"comment:文章标题;type:varchar(100);" json:"title"`
	Cover   string `gorm:"comment:文章封面;type:varchar(255);" json:"cover"`
	Label   string `gorm:"comment:文章标签;type:varchar(50);" json:"label"`
	Summary string `gorm:"comment:文章摘要;type:varchar(255);" json:"summary"`
	View    int    `gorm:"comment:浏览量;" json:"view"`
	Content string `gorm:"comment:文章内容;type:longtext;" json:"content"`
	gorm.Model
}

Article @Date 2023-02-18 18:03:55 @Description: 文章数据库表

type ArticleComment

type ArticleComment struct {
	ArticleCommentMeta
	Comment Comment `gorm:"foreignKey:CommentId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	Article Article `gorm:"foreignKey:ArticleId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	CommentId uint `json:"commentId" gorm:"comment:评论ID;primaryKey;"`
	ArticleId uint `json:"articleId" gorm:"comment:关联的文章ID;primaryKey;"`
}

ArticleComment @Date 2023-02-23 20:21:38 @Description: 文章评论关联表

type ArticleCommentMeta

type ArticleCommentMeta struct{}

func (ArticleCommentMeta) TableComment

func (ArticleCommentMeta) TableComment() string

func (ArticleCommentMeta) TableName

func (ArticleCommentMeta) TableName() string

type ArticleMeta

type ArticleMeta struct{}

func (ArticleMeta) TableComment

func (ArticleMeta) TableComment() string

func (ArticleMeta) TableName

func (ArticleMeta) TableName() string

type Class

type Class struct {
	ClassMeta
	Name string `gorm:"comment:分类名称;type:varchar(255);"`
	gorm.Model
}

Class @Date 2023-02-25 19:07:01 @Description: 文章分类表

type ClassMeta

type ClassMeta struct{}

func (ClassMeta) TableComment

func (ClassMeta) TableComment() string

func (ClassMeta) TableName

func (ClassMeta) TableName() string

type Comment

type Comment struct {
	CommentMeta
	User SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	UserId  uint   `json:"userId" gorm:"comment:用户ID;"`
	Content string `json:"content" gorm:"comment:评论内容;type:text;"`
	gorm.Model
}

Comment @Date 2023-02-23 20:23:46 @Description: 评论信息表

type CommentMeta

type CommentMeta struct{}

func (CommentMeta) TableComment

func (CommentMeta) TableComment() string

func (CommentMeta) TableName

func (CommentMeta) TableName() string

type Date

type Date time.Time

Date @Date: 2023-02-27 23:13:06 日期类型,方便前后端时间格式转换

type File

type File struct {
	FileMeta
	User   SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	UserId uint       `json:"userId" gorm:"comment:用户ID;"`
	Name   string     `gorm:"comment:文件名称;"`
	Type   string     `gorm:"comment:文件类型;"`
	Dir    string     `gorm:"comment:文件目录;"`
	Path   string     `gorm:"comment:文件路径;"`
	Url    string     `gorm:"comment:文件映射路径;"`
	gorm.Model
}

type FileMeta

type FileMeta struct{}

func (FileMeta) TableComment

func (m FileMeta) TableComment() string

func (FileMeta) TableName

func (FileMeta) TableName() string

type Like

type Like struct {
	LikeMeta
	User   SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	UserId uint       `json:"userId" gorm:"comment:用户ID;"`
	Like   int        `json:"like" gorm:"comment:点赞数量;type:bigint;"`
	gorm.Model
}

Like @Date 2023-02-23 20:25:46 @Description: 点赞信息表

type LikeMeta

type LikeMeta struct{}

func (LikeMeta) TableComment

func (LikeMeta) TableComment() string

func (LikeMeta) TableName

func (LikeMeta) TableName() string

type Reply

type Reply struct {
	ReplyMeta
	User    SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	Comment Comment    `gorm:"foreignKey:CommentId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	UserId    uint   `json:"userId" gorm:"comment:用户ID;"`
	CommentId uint   `json:"commentId" gorm:"comment:评论ID;"`
	Content   string `json:"content" gorm:"comment:回复内容;type:text;"`
	gorm.Model
}

Reply @Date 2023-02-23 22:30:16 @Description: 回复信息表

type ReplyMeta

type ReplyMeta struct{}

func (ReplyMeta) TableComment

func (ReplyMeta) TableComment() string

func (ReplyMeta) TableName

func (ReplyMeta) TableName() string

type Share

type Share struct {
	ShareMeta
	User SystemUser `gorm:"foreignKey:UserId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	UserId  uint   `json:"userId" gorm:"comment:用户ID;"`
	Content string `json:"content" gorm:"comment:动态内容;type:text;"`
	gorm.Model
}

Share @Date 2023-02-23 20:58:37 @Description: 动态信息表

type ShareComment

type ShareComment struct {
	ShareCommentMeta
	Comment Comment `gorm:"foreignKey:CommentId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`
	Share   Share   `gorm:"foreignKey:ShareId;constraint:onUpdate:RESTRICT,onDelete:CASCADE"`

	CommentId uint `json:"commentId" gorm:"comment:评论ID;primaryKey;"`
	ShareId   uint `json:"shareId" gorm:"comment:动态ID;primaryKey;"`
}

ShareComment @Date 2023-02-24 23:44:43 @Description: 动态评论关联表

type ShareCommentMeta

type ShareCommentMeta struct{}

func (ShareCommentMeta) TableComment

func (ShareCommentMeta) TableComment() string

func (ShareCommentMeta) TableName

func (ShareCommentMeta) TableName() string

type ShareMeta

type ShareMeta struct{}

func (ShareMeta) TableComment

func (ShareMeta) TableComment() string

func (ShareMeta) TableName

func (ShareMeta) TableName() string

type SystemUser

type SystemUser struct {
	UserMeta
	Uuid        string `gorm:"comment:用户ID;type:varchar(255);" json:"uuid"`
	Username    string `gorm:"comment:用户登录账号;type:varchar(50);" json:"username"`
	Password    string `gorm:"comment:用户登录密码;type:varchar(255);" json:"password"`
	Nickname    string `gorm:"comment:用户昵称;type:varchar(50);" json:"nickname"`
	Description string `gorm:"comment:用户自我描述;type:varchar(100);" json:"description"`
	Avatar      string `gorm:"comment:用户头像;type:varchar(255);" json:"avatar"`
	Phone       string `gorm:"comment:用户手机号;type:varchar(50);" json:"phone"`
	Email       string `gorm:"comment:用户邮箱;type:varchar(255);" json:"email"`
	Enable      bool   `gorm:"comment:用户是否启用;" json:"enable"`
	gorm.Model
}

SystemUser @Date 2023-01-13 15:23:50 @Description: 系统用户结构体

type TableGroup

type TableGroup = map[string]TableList

type TableList

type TableList = []TableMeta

type TableMeta

type TableMeta interface {
	TableComment() string
	TableName() string
}

type UserMeta

type UserMeta struct{}

func (UserMeta) TableComment

func (UserMeta) TableComment() string

func (UserMeta) TableName

func (UserMeta) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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