models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

* @Author: alexander.huang * @Date: 2022-05-25 22:53:50 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-25 22:53:50

* @Author: alexander.huang * @Date: 2022-05-18 21:53:41 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-23 21:40:51

* @Author: alexander.huang * @Date: 2022-05-25 22:53:50 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-25 22:53:50

* @Author: alexander.huang * @Date: 2022-05-25 22:53:50 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-25 22:53:50

* @Author: alexander.huang * @Date: 2022-05-18 22:20:50 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-23 21:40:51

* @Author: alexander.huang * @Date: 2022-05-25 02:53:50 * @Last Modified by: alexander.huang * @Last Modified time: 2022-05-25 02:53:50

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID
	UserID      uint64 `json:"user_id"`      // 用户ID
	VideoID     uint64 `json:"video_id"`     // 视频ID
	CommentText string `json:"comment_text"` // 评论内容
	Timestamps
	SoftDeletes
}

type Favorite

type Favorite struct {
	ID
	UserID  uint64 `json:"user_id"`  // 点赞的用户ID
	VideoID uint64 `json:"video_id"` // 被点赞的视频ID
	Timestamps
	SoftDeletes
}

type ID

type ID struct {
	ID uint64 `json:"id" gorm:"primaryKey"`
}

primary key ID

type Relation

type Relation struct {
	ID
	UserID   uint64 `json:"user_id"`   // 用户ID
	FollowID uint64 `json:"follow_id"` // 被关注用户ID
	Timestamps
	SoftDeletes
}

type SoftDeletes

type SoftDeletes struct {
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

soft delete

type Timestamps

type Timestamps struct {
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

create and update time

type User

type User struct {
	ID
	Name          string `json:"name" gorm:"not null;comment:用户名称"`
	Password      string `json:"password" gorm:"not null;default:'';comment:用户密码"`
	Token         string `json:"token"    gorm:"not null;comment:鉴权token"`
	FollowCount   uint64 `json:"follow_count" gorm:"not null;default:0;comment:关注总数"`
	FollowerCount uint64 `json:"follower_count" gorm:"not null;default:0;comment:粉丝总数"`
	IsFollow      bool   `json:"is_follow" gorm:"not null;default:false;comment:是否关注"`
	Timestamps
	SoftDeletes
}

func (User) GetUid

func (user User) GetUid() string

type Video

type Video struct {
	ID
	AuthorID      uint64 `json:"author_id" gorm:"not null;comment:作者id"`
	PlayUrl       string `json:"play_url"  gorm:"not null;default:'';comment:视频地址"`
	CoverUrl      string `json:"cover_url" gorm:"not null;default:'';comment:封面地址"`
	FavoriteCount uint64 `json:"favorite_count" gorm:"not null;default:0;comment:点赞总数"`
	CommentCount  uint64 `json:"comment_count" gorm:"not null;default:0;comment:评论总数"`
	IsFavorite    bool   `json:"is_favorite" gorm:"not null;default:false;comment:是否点赞"`
	DiskType      string `json:"disk_type" gorm:"size:20;index;not null;comment:存储类型"`
	SrcType       int8   `json:"src_type" gorm:"not null;comment:链接类型 1相对路径 2外链"`
	Timestamps
	SoftDeletes
}

Jump to

Keyboard shortcuts

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