pubsub

package
v0.0.0-...-d64eb31 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Id        string    `json:"id"`
	Channel   string    `json:"channel"`
	Data      any       `json:"data"`
	CreatedAt time.Time `json:"created_at"`
}

func NewMessage

func NewMessage(data interface{}) *Message

func (*Message) Marshal

func (m *Message) Marshal() ([]byte, error)

func (*Message) SetTopic

func (m *Message) SetTopic(topic string)

func (*Message) Unmarshal

func (m *Message) Unmarshal(b []byte) error

type Pubsub

type Pubsub interface {
	Publish(ctx context.Context, topic string, data *Message) error
	Subscribe(ctx context.Context, topic string) (ch <-chan *Message, close func())
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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