notification

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package notification provides a portable notification API with cross-cutting concerns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notification

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

Notification is the portable notification type wrapping a driver with cross-cutting concerns.

func NewNotification

func NewNotification(d driver.Notification, opts ...Option) *Notification

NewNotification creates a new portable Notification wrapping the given driver.

func (*Notification) CreateTopic

func (n *Notification) CreateTopic(ctx context.Context, config driver.TopicConfig) (*driver.TopicInfo, error)

CreateTopic creates a new notification topic.

func (*Notification) DeleteTopic

func (n *Notification) DeleteTopic(ctx context.Context, id string) error

DeleteTopic deletes a notification topic.

func (*Notification) GetTopic

func (n *Notification) GetTopic(ctx context.Context, id string) (*driver.TopicInfo, error)

GetTopic retrieves topic info.

func (*Notification) ListSubscriptions

func (n *Notification) ListSubscriptions(ctx context.Context, topicID string) ([]driver.SubscriptionInfo, error)

ListSubscriptions lists all subscriptions for a topic.

func (*Notification) ListTopics

func (n *Notification) ListTopics(ctx context.Context) ([]driver.TopicInfo, error)

ListTopics lists all topics.

func (*Notification) Publish

Publish publishes a message to a topic.

func (*Notification) Subscribe

Subscribe creates a subscription to a topic.

func (*Notification) Unsubscribe

func (n *Notification) Unsubscribe(ctx context.Context, subscriptionID string) error

Unsubscribe removes a subscription.

type Option

type Option func(*Notification)

Option configures a portable Notification.

func WithErrorInjection

func WithErrorInjection(i *inject.Injector) Option

WithErrorInjection sets the error injector.

func WithLatency

func WithLatency(d time.Duration) Option

WithLatency sets simulated latency.

func WithMetrics

func WithMetrics(m *metrics.Collector) Option

WithMetrics sets the metrics collector.

func WithRateLimiter

func WithRateLimiter(l *ratelimit.Limiter) Option

WithRateLimiter sets the rate limiter.

func WithRecorder

func WithRecorder(r *recorder.Recorder) Option

WithRecorder sets the recorder.

Directories

Path Synopsis
Package driver defines the interface for notification service implementations.
Package driver defines the interface for notification service implementations.

Jump to

Keyboard shortcuts

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