dao

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateComment

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

func CreateFavorite

func CreateFavorite(ctx context.Context, uid, vid uint64) error

func CreateVideo

func CreateVideo(ctx context.Context, videos []*Video) error

func DeleteComment

func DeleteComment(ctx context.Context, uid, cid uint64) error

func DeleteFavorite

func DeleteFavorite(ctx context.Context, uid, vid uint64) error

func GetSetInt64List

func GetSetInt64List(ctx context.Context, key string) ([]uint64, error)

func Init

func Init()

func InitMysql

func InitMysql()

InitMysql init mysql

func InitRDB

func InitRDB()

InitRDB init redis

func MGetFavoriteVideoIDs

func MGetFavoriteVideoIDs(ctx context.Context, uid uint64) (ids []uint64, err error)

func QueryCommentCount

func QueryCommentCount(ctx context.Context, vid int64) (uint64, error)

func QueryFavoriteCount

func QueryFavoriteCount(ctx context.Context, vid uint64) uint64

func QueryIsFavorite

func QueryIsFavorite(ctx context.Context, uid, vid uint64) bool

Types

type Comment

type Comment struct {
	gorm.Model
	UID     uint64 `gorm:"column:uid"`
	VID     uint64 `gorm:"column:vid"`
	Content string `gorm:"column:content"`
}

func MGetComments

func MGetComments(ctx context.Context, vid uint64) ([]*Comment, error)

func (*Comment) TableName

func (m *Comment) TableName() string

type Video

type Video struct {
	gorm.Model
	Title         string `gorm:"column:title"`
	AuthorID      uint64 `gorm:"column:uid"`
	PlayUrl       string `gorm:"column:play_url"`
	CoverUrl      string `gorm:"column:cover_url"`
	FavoriteCount uint64 `gorm:"-"`
	CommentCount  uint64 `gorm:"-"`
	IsFavorite    bool   `gorm:"-"`
}

Video 影音视频字段

func MGetVideos

func MGetVideos(ctx context.Context, uid, nextTime uint64) ([]*Video, error)

MGetVideos multiple get list of video info

func MGetVideosByIDs

func MGetVideosByIDs(ctx context.Context, vids []uint64) ([]*Video, error)

func MGetVideosByUID

func MGetVideosByUID(ctx context.Context, uid uint64) ([]*Video, error)

func (*Video) TableName

func (m *Video) TableName() string

Jump to

Keyboard shortcuts

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