models

package
v0.0.0-...-3ac9adb Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	gorm.Model
	UserID  uint
	VideoID uint
	Content string `gorm:"index;size:100"`
}

type Subscribe

type Subscribe struct {
	UserID       uint
	SubscriberID uint
}

type User

type User struct {
	gorm.Model
	Name           string    `gorm:"uniqueIndex;size:10"`
	Password       string    `gorm:"size:60"`
	Content        string    `gorm:"size:50"`
	Videos         []Video   `gorm:"ForeignKey:AuthorID"`
	Comments       []Comment `gorm:"many2many:comments;joinForeignKey:UserID"`
	FavoriteVideos []Video   `gorm:"many2many:user_favorite_videos"`
	Subscribers    []User    `gorm:"joinForeignKey:UserID;many2many:subscribes"`
	Followers      []User    `gorm:"joinForeignKey:SubscriberID;many2many:subscribes"`
}

type Video

type Video struct {
	gorm.Model
	AuthorID      uint
	Title         string    `gorm:"size:30"`
	Author        User      `gorm:"reference:ID"`
	UserFavorites []User    `gorm:"many2many:user_favorite_videos"`
	Comments      []Comment `gorm:"many2many:comments;joinForeignKey:VideoID"`
}

Jump to

Keyboard shortcuts

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