service

package
v0.0.0-...-283b16c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Webhook = "WEBHOOK"
	Slack   = "SLACK"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	// CreateNotification stores the given notification and creates delivery records
	// based on the subscribed deliverers
	//
	// delivery records are created with CREATED state and will be picked up by the
	// worker to tell the deliverer to kick off the delivery
	CreateNotification(ctx context.Context, n model.Notification) error

	// CreateDeliverer creates a new Deliverer in the DB
	//
	// Deliverer delivers notification deliveries which are in CREATED status
	CreateDeliverer(ctx context.Context, n model.Deliverer) error

	// KickOff initiates the Notifier worker.
	//
	// Worker starts all the enabled deliverer's delivery.
	KickOff(ctx context.Context) error
}

func New

func New(db *sql.DB, cfg *config.Config) (Service, error)

New creates a New notifier service and kicks off the notification deliveries

Canceling the ctx will kill any concurrent routines affiliated with the notifier.

Jump to

Keyboard shortcuts

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