model

package
v0.0.0-...-5a2b5b4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	gorm.Model

	Title          string // 标题
	Content        string // 内容
	PimaryImageURL string // 主图链接内容
	UserID         uint   // 作者
	User           User   // 作者

	Products []Product `gorm:"many2many:articles_products;"`
}

type Comment

type Comment struct {
	gorm.Model

	Content string // 内容

	WriterID uint // 发布人 ID

	PostID uint // 外键
}

type Post

type Post struct {
	gorm.Model

	Content  string  // 内容
	ImageURL *string // 图片(1)链接
	FileURL  *string // 文件(1)链接

	WriterID uint // 发布人 ID

	Comments []Comment
}

type Product

type Product struct {
	gorm.Model

	Title           string  // 标题
	Price           float64 // 价格
	Description     string  // 描述
	PrimaryImageURL string  // 主图链接
	Category        string  // 分类 (regular/NFT)
	UserID          uint    // 发布人 ID
}

type User

type User struct {
	gorm.Model

	Username    string
	Password    string
	Role        string
	Name        string // 真实姓名
	Tel         string // 电话
	ShortTitle  string // 称谓
	JobTitle    string // 称谓
	Point       float64
	Sex         string
	AvatarUrl   string // 头像
	Description string // 简介

	// Has many relations
	Articles []*Article

	// Many to many relations
	FavoriteArticles []*Article `gorm:"many2many:user_article"`
	FollowedUsers    []*User    `gorm:"many2many:user_followed"`
	CartProducts     []*Product `gorm:"many2many:user_cart"`
}

Jump to

Keyboard shortcuts

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