Help us shape the future of Go! Take the 2026 Go Developer Survey

events

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Types

type Config

type Config struct {
	Timeout time.Duration
}

type Event

type Event struct {
	Type    string          `json:"type"`
	Payload json.RawMessage `json:"payload"`
}

func NewEvent

func NewEvent(eventType string, payload json.RawMessage) *Event

func (*Event) Marshal

func (e *Event) Marshal() ([]byte, error)

func (*Event) Unmarshal

func (e *Event) Unmarshal(data []byte) error

type EventWrapper

type EventWrapper struct {
	ID    string
	Event Event
	Ack   func() bool
	Nack  func() bool
}

type Publisher

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

func NewPublisher

func NewPublisher(sql *sql.DB, logger *zap.Logger) (*Publisher, error)

func (*Publisher) Close

func (p *Publisher) Close() error

func (*Publisher) Publish

func (p *Publisher) Publish(id string, event Event) error

type Subscriber

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

func NewSubscriber

func NewSubscriber(config Config, sql *sql.DB, logger *zap.Logger) (*Subscriber, error)

func (*Subscriber) Close

func (s *Subscriber) Close() error

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(ctx context.Context) (<-chan *EventWrapper, error)

Jump to

Keyboard shortcuts

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