pubsub

package
v2.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelPrefix   = "rumors.event."
	ChannelArticles = ChannelPrefix + "articles"
	ChannelTg       = ChannelPrefix + "telegram"

	OpMarshal = "pubsub: marshal"
	OpPublish = "pubsub: publish"
	OpClose   = "pubsub: close"
)

Variables

This section is empty.

Functions

func PublisherActivator

func PublisherActivator() *di.Activator

func SubscriberActivator

func SubscriberActivator() *di.Activator

Types

type Article

type Article struct {
	ID         uuid.UUID `json:"id,omitempty"`
	SiteID     uuid.UUID `json:"site_id,omitempty"`
	Lang       string    `json:"lang,omitempty"`
	Title      string    `json:"title,omitempty"`
	ShortDesc  string    `json:"short_desc,omitempty"`
	Link       string    `json:"link,omitempty"`
	Image      string    `json:"image,omitempty"`
	PubDate    time.Time `json:"pub_date,omitempty"`
	PubDiff    string    `json:"pub_diff,omitempty"`
	Categories []string  `json:"categories,omitempty"`
}

func FromEntity

func FromEntity(e *entity.Article) Article

type PubKey

type PubKey struct{}

type Publisher

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

func GetPub

func GetPub(ctx context.Context, c ...di.Container) (*Publisher, error)

func NewPublisher

func NewPublisher(rdbMaker *rdb.UniversalClientMaker) *Publisher

func (*Publisher) Articles

func (p *Publisher) Articles(ctx context.Context, articles []Article)

func (*Publisher) Close

func (p *Publisher) Close() error

func (*Publisher) Telegram

func (p *Publisher) Telegram(ctx context.Context, message any)

type SubKey

type SubKey struct{}

type Subscriber

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

func GetSub

func GetSub(ctx context.Context, c ...di.Container) (*Subscriber, error)

func NewSubscriber

func NewSubscriber(rdbMaker *rdb.UniversalClientMaker) *Subscriber

func (*Subscriber) All

func (s *Subscriber) All(ctx context.Context) *redis.PubSub

func (*Subscriber) Articles

func (s *Subscriber) Articles(ctx context.Context) *redis.PubSub

func (*Subscriber) Close

func (s *Subscriber) Close() (err error)

func (*Subscriber) Telegram

func (s *Subscriber) Telegram(ctx context.Context) *redis.PubSub

Jump to

Keyboard shortcuts

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