db

package
v0.0.0-...-5713efe Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func CountCommentsByVideoId

func CountCommentsByVideoId(ctx context.Context, videoId int64) (int64, error)

func CreateFavorite

func CreateFavorite(ctx context.Context, favorite *Favorite) error

func GetFavouriteVideosByUid

func GetFavouriteVideosByUid(ctx context.Context, uid int64) ([]int64, error)

func GetUserFavouriteCount

func GetUserFavouriteCount(ctx context.Context, uid int64) (int64, error)

func GetVideoFavouriteCount

func GetVideoFavouriteCount(ctx context.Context, vid int64) (int64, error)

func Init

func Init()

func IsFavoriteExist

func IsFavoriteExist(ctx context.Context, uid int64, vid int64) (bool, error)

func IsFavorited

func IsFavorited(ctx context.Context, uid int64, vid int64, status int64) error

func UpdateFavoriteStatus

func UpdateFavoriteStatus(ctx context.Context, uid int64, vid int64, status int64) error

func UpdateVideoFavouriteCount

func UpdateVideoFavouriteCount(ctx context.Context, vid int64, count int64) error

Types

type Comment

type Comment struct {
	Id        int64  `json:"id"`
	UserId    int64  `json:"user_id"`
	VideoId   int64  `json:"video_id"`
	Content   string `json:"content"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

func CreateComment

func CreateComment(ctx context.Context, comment *Comment) (*Comment, error)

func DeleteComment

func DeleteComment(ctx context.Context, comment *Comment) (*Comment, error)

func GetCommentById

func GetCommentById(ctx context.Context, commentId int64) (*Comment, error)

func GetCommentsByVideoId

func GetCommentsByVideoId(ctx context.Context, videoId int64) ([]Comment, error)

type Favorite

type Favorite struct {
	ID        int64 `json:"id"`
	UserID    int64 `json:"user_id"`
	VideoID   int64 `json:"video_id"`
	Status    int64 `json:"status"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type VideoFavourite

type VideoFavourite struct {
	ID            int64 `json:"id"`
	VideoID       int64 `json:"video_id"`
	FavoriteCount int64 `json:"favorite_count"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     gorm.DeletedAt `gorm:"index"`
}

Jump to

Keyboard shortcuts

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