model

package
v0.0.0-...-4cd4f3f Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const TableNameComment = "comment"
View Source
const TableNameFavorite = "favorite"
View Source
const TableNameMessage = "message"
View Source
const TableNameRelation = "relation"
View Source
const TableNameUser = "user"
View Source
const TableNameVideo = "video"

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID       int32     `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	VideoID  int32     `gorm:"column:video_id;not null" json:"video_id"`
	UserID   int32     `gorm:"column:user_id;not null" json:"user_id"`
	Content  string    `gorm:"column:content" json:"content"`
	CreateAt time.Time `gorm:"column:create_at;default:CURRENT_TIMESTAMP" json:"create_at"`
	Author   User      `gorm:"foreignKey:UserID" json:"author"`
}

Comment mapped from table <comment>

func (*Comment) TableName

func (*Comment) TableName() string

TableName Comment's table name

type Favorite

type Favorite struct {
	ID      int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	UserID  int32 `gorm:"column:user_id;not null" json:"user_id"`
	VideoID int32 `gorm:"column:video_id;not null" json:"video_id"`
}

Favorite mapped from table <favorite>

func (*Favorite) TableName

func (*Favorite) TableName() string

TableName Favorite's table name

type Message

type Message struct {
	ID       int32     `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	UserID   int32     `gorm:"column:user_id;not null" json:"user_id"` // 发送方
	ToUserID int32     `gorm:"column:to_user_id" json:"to_user_id"`    // 接收方
	Content  string    `gorm:"column:content" json:"content"`
	CreateAt time.Time `gorm:"column:create_at;default:CURRENT_TIMESTAMP" json:"create_at"`
}

Message mapped from table <message>

func (*Message) TableName

func (*Message) TableName() string

TableName Message's table name

type Relation

type Relation struct {
	ID         int32     `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	UserID     int32     `gorm:"column:user_id;not null" json:"user_id"`       // 关注者id
	ToUserID   int32     `gorm:"column:to_user_id;not null" json:"to_user_id"` // 被关注者id
	CreateAt   time.Time `gorm:"column:create_at;default:CURRENT_TIMESTAMP" json:"create_at"`
	User       User      `gorm:"foreignKey:UserID" json:"user"`
	FollowUser User      `gorm:"foreignKey:ToUserID" json:"follow_user"`
}

Relation mapped from table <relation>

func (*Relation) TableName

func (*Relation) TableName() string

TableName Relation's table name

type User

type User struct {
	ID              int32     `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	Username        string    `gorm:"column:username;not null" json:"username"`
	Password        string    `gorm:"column:password;not null" json:"password"`
	FollowCount     int32     `gorm:"column:follow_count" json:"follow_count"`     // 关注数
	FollowerCount   int32     `gorm:"column:follower_count" json:"follower_count"` // 粉丝数
	Avatar          string    `gorm:"column:avatar;not null" json:"avatar"`
	CreateAt        time.Time `gorm:"column:create_at;not null;default:CURRENT_TIMESTAMP" json:"create_at"`
	UpdateAt        time.Time `gorm:"column:update_at;not null;default:CURRENT_TIMESTAMP" json:"update_at"`
	BackgroundImage string    `gorm:"column:background_image" json:"background_image"`
	Signature       string    `gorm:"column:signature" json:"signature"`
	TotalFavorited  int32     `gorm:"column:total_favorited" json:"total_favorited"` // 获赞数量
	WorkCount       int32     `gorm:"column:work_count" json:"work_count"`           // 作品数量
	FavoriteCount   int32     `gorm:"column:favorite_count" json:"favorite_count"`   // 点赞数量
}

User mapped from table <user>

func (*User) TableName

func (*User) TableName() string

TableName User's table name

type Video

type Video struct {
	ID            int32     `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	UserID        int32     `gorm:"column:user_id;not null" json:"user_id"`
	PlayURL       string    `gorm:"column:play_url;not null" json:"play_url"`             // 视频播放地址
	CoverURL      string    `gorm:"column:cover_url;not null" json:"cover_url"`           // 视频封面地址
	FavoriteCount int32     `gorm:"column:favorite_count;not null" json:"favorite_count"` // 视频点赞数
	CommentCount  int32     `gorm:"column:comment_count;not null" json:"comment_count"`   // 视频评论数
	Title         string    `gorm:"column:title;not null" json:"title"`
	CreateAt      time.Time `gorm:"column:create_at;default:CURRENT_TIMESTAMP" json:"create_at"`
	UpdateAt      time.Time `gorm:"column:update_at;default:CURRENT_TIMESTAMP" json:"update_at"`
	Author        User      `gorm:"foreignKey:UserID" json:"author"`
}

Video mapped from table <video>

func (*Video) TableName

func (*Video) TableName() string

TableName Video's table name

Jump to

Keyboard shortcuts

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