pkg

package
v0.0.0-...-55e1567 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackVideo

func PackVideo(video *model.Video, author *base.User, info *base.VideoInteractInfo) *base.Video

func PackVideos

func PackVideos(videoList []*model.Video, authorList []*base.User, infoList []*base.VideoInteractInfo) []*base.Video

func SubscribeRoutine

func SubscribeRoutine(subscriber *Subscriber, dao *dao.Video) error

func Video

func Video(v *model.Video) *base.Video

Video model to idl

func Videos

func Videos(videos []*model.Video) []*base.Video

Videos model to idl

Types

type InteractionManager

type InteractionManager struct {
	InteractionService interactionserver.Client
}

func (*InteractionManager) BatchGetVideoInteractInfo

func (i *InteractionManager) BatchGetVideoInteractInfo(ctx context.Context, videoIdList []int64, viewerId int64) ([]*base.VideoInteractInfo, error)

BatchGetVideoInteractInfo batch get video interactInfo.

func (*InteractionManager) GetFavoriteVideoIdList

func (i *InteractionManager) GetFavoriteVideoIdList(ctx context.Context, userId int64) ([]int64, error)

GetFavoriteVideoIdList gets the favorite video id list.

func (*InteractionManager) GetVideoInteractInfo

func (i *InteractionManager) GetVideoInteractInfo(ctx context.Context, videoId, viewerId int64) (*base.VideoInteractInfo, error)

GetVideoInteractInfo get video interactInfo.

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

Publisher implements an amqp publisher.

func NewPublisher

func NewPublisher(conn *amqp.Connection, exchange string) (*Publisher, error)

func (*Publisher) Publish

func (p *Publisher) Publish(_ context.Context, video *model.Video) error

Publish publishes a video record.

type RedisManager

type RedisManager struct {
	RedisClient *redis.Client
}

func NewRedisManager

func NewRedisManager(client *redis.Client) *RedisManager

func (*RedisManager) BatchGetVideoByVideoId

func (r *RedisManager) BatchGetVideoByVideoId(ctx context.Context, videoIdList []int64) ([]*model.Video, error)

func (*RedisManager) CreateVideo

func (r *RedisManager) CreateVideo(ctx context.Context, video *model.Video) error

func (*RedisManager) DeleteVideoById

func (r *RedisManager) DeleteVideoById(ctx context.Context, videoId int64) error

func (*RedisManager) GetVideoByVideoId

func (r *RedisManager) GetVideoByVideoId(ctx context.Context, videoId int64) (*model.Video, error)

func (*RedisManager) GetVideoIdListByAuthorId

func (r *RedisManager) GetVideoIdListByAuthorId(ctx context.Context, authorId int64) ([]int64, error)

func (*RedisManager) GetVideoListByAuthorId

func (r *RedisManager) GetVideoListByAuthorId(ctx context.Context, authorId int64) ([]*model.Video, error)

func (*RedisManager) GetVideoListByLatestTime

func (r *RedisManager) GetVideoListByLatestTime(ctx context.Context, latestTime int64) ([]*model.Video, error)

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Subscriber implements an amqp subscriber.

func NewSubscriber

func NewSubscriber(conn *amqp.Connection, exchange string) (*Subscriber, error)

NewSubscriber creates an amqp subscriber.

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(c context.Context) (videoChan chan *model.Video, cleanUpFunc func(), err error)

Subscribe subscribes and returns a channel with video publish request.

func (*Subscriber) SubscribeRaw

func (s *Subscriber) SubscribeRaw(_ context.Context) (<-chan amqp.Delivery, func(), error)

SubscribeRaw subscribes and returns a channel with raw amqp delivery.

type UserManager

type UserManager struct {
	UserService userservice.Client
}

func (*UserManager) BatchGetUser

func (m *UserManager) BatchGetUser(ctx context.Context, list []int64, viewerId int64) ([]*base.User, error)

BatchGetUser gets users info by list.

func (*UserManager) GetUser

func (m *UserManager) GetUser(ctx context.Context, viewerId, ownerId int64) (*base.User, error)

GetUser gets user info.

Jump to

Keyboard shortcuts

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