db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 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 FavoriteCreate

func FavoriteCreate(ctx context.Context, fav *Favorite) error

func GetUserFavoriteCount

func GetUserFavoriteCount(ctx context.Context, userID int64) (int64, error)

func GetVideoLikeCount

func GetVideoLikeCount(ctx context.Context, videoID int64) (int64, error)

func GetVideosByUserId

func GetVideosByUserId(ctx context.Context, userID int64) ([]int64, error)

func Init

func Init()

func IsFavoriteExist

func IsFavoriteExist(ctx context.Context, userID int64, videoID int64) error

func IsFavorited

func IsFavorited(ctx context.Context, userID int64, videoID int64, status int64) error

func UpdateFavoriteStatus

func UpdateFavoriteStatus(ctx context.Context, userID int64, videoID int64, status int64) error

Types

type Comment

type Comment struct {
	Id        int64          `msg:"i"`
	UserId    int64          `msg:"u"`
	VideoId   int64          `msg:"-"`
	Content   string         `msg:"c"`
	CreatedAt time.Time      `msg:"-"`
	UpdatedAt time.Time      `msg:"-"`
	DeletedAt gorm.DeletedAt `gorm:"index" msg:"-"`
}

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)

func (Comment) MarshalMsg

func (z Comment) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Comment) Msgsize

func (z Comment) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Comment) UnmarshalMsg

func (z *Comment) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Favorite

type Favorite struct {
	ID        int64
	UserID    int64
	VideoID   int64
	Status    int64
	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