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

View Source
var (
	ErrNoSuchRecord       = errors.New("no such record")
	ErrRecordAlreadyExist = errors.New("record already exist")
)

Functions

func Comment

func Comment(c *model.Comment) *base.Comment

Comment model to idl

func CommentSubscribeRoutine

func CommentSubscribeRoutine(subscriber *CommentSubscriber, dao *dao.Comment) error

func Comments

func Comments(c []*model.Comment) []*base.Comment

Comments model to idl

func FavoriteSubscribeRoutine

func FavoriteSubscribeRoutine(subscriber *FavoriteSubscriber, dao *dao.Favorite) error

Types

type CommentPublisher

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

CommentPublisher implements an amqp publisher.

func NewCommentPublisher

func NewCommentPublisher(conn *amqp.Connection, exchange string) (*CommentPublisher, error)

func (*CommentPublisher) Publish

func (p *CommentPublisher) Publish(_ context.Context, comment *model.Comment) error

Publish publishes a comment model.

type CommentRedisManager

type CommentRedisManager struct {
	RedisClient *redis.Client
}

func NewCommentRedisManager

func NewCommentRedisManager(client *redis.Client) *CommentRedisManager

func (*CommentRedisManager) CommentCountByVideoId

func (r *CommentRedisManager) CommentCountByVideoId(ctx context.Context, videoId int64) (int64, error)

func (*CommentRedisManager) CreateComment

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

func (*CommentRedisManager) DeleteComment

func (r *CommentRedisManager) DeleteComment(ctx context.Context, commentId int64) error

func (*CommentRedisManager) GetCommentListByVideoId

func (r *CommentRedisManager) GetCommentListByVideoId(ctx context.Context, videoId int64) ([]*model.Comment, error)

type CommentSubscriber

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

CommentSubscriber implements an amqp subscriber.

func NewCommentSubscriber

func NewCommentSubscriber(conn *amqp.Connection, exchange string) (*CommentSubscriber, error)

NewCommentSubscriber creates an amqp subscriber.

func (*CommentSubscriber) Subscribe

func (s *CommentSubscriber) Subscribe(c context.Context) (chan *model.Comment, func(), error)

Subscribe subscribes and returns a channel with Favorite action request.

func (*CommentSubscriber) SubscribeRaw

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

SubscribeRaw subscribes and returns a channel with raw amqp delivery.

type FavoritePublisher

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

FavoritePublisher implements an amqp publisher.

func NewFavoritePublisher

func NewFavoritePublisher(conn *amqp.Connection, exchange string) (*FavoritePublisher, error)

func (*FavoritePublisher) Publish

func (p *FavoritePublisher) Publish(_ context.Context, fav *model.Favorite) error

Publish publishes a favorite model.

type FavoriteRedisManager

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

func NewFavoriteRedisManager

func NewFavoriteRedisManager(client *redis.Client) *FavoriteRedisManager

func (*FavoriteRedisManager) Check

func (r *FavoriteRedisManager) Check(ctx context.Context, userId, videoId int64) (bool, error)

func (*FavoriteRedisManager) GetFavoriteCountByVideoId

func (r *FavoriteRedisManager) GetFavoriteCountByVideoId(ctx context.Context, videoId int64) (int64, error)

func (*FavoriteRedisManager) GetFavoriteVideoCountByUserId

func (r *FavoriteRedisManager) GetFavoriteVideoCountByUserId(ctx context.Context, userId int64) (int64, error)

func (*FavoriteRedisManager) GetFavoriteVideoIdListByUserId

func (r *FavoriteRedisManager) GetFavoriteVideoIdListByUserId(ctx context.Context, userId int64) ([]int64, error)

func (*FavoriteRedisManager) Like

func (r *FavoriteRedisManager) Like(ctx context.Context, userId, videoId, time int64) error

func (*FavoriteRedisManager) Unlike

func (r *FavoriteRedisManager) Unlike(ctx context.Context, userId, videoId int64) error

type FavoriteSubscriber

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

FavoriteSubscriber implements an amqp subscriber.

func NewFavoriteSubscriber

func NewFavoriteSubscriber(conn *amqp.Connection, exchange string) (*FavoriteSubscriber, error)

NewFavoriteSubscriber creates an amqp subscriber.

func (*FavoriteSubscriber) Subscribe

func (s *FavoriteSubscriber) Subscribe(c context.Context) (chan *model.Favorite, func(), error)

Subscribe subscribes and returns a channel with Favorite model.

func (*FavoriteSubscriber) SubscribeRaw

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

SubscribeRaw subscribes and returns a channel with raw amqp delivery.

type VideoManager

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

func NewVideoManager

func NewVideoManager(client videoservice.Client) *VideoManager

func (*VideoManager) GetPublishedVideoIdList

func (m *VideoManager) GetPublishedVideoIdList(ctx context.Context, userId int64) ([]int64, error)

Jump to

Keyboard shortcuts

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