notification

package
v0.0.0-...-ac0e98d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package notification provides a core business API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("notification not found")
)

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type Core

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

Core manages the set of APIs for notification access.

func NewCore

func NewCore(log *zerolog.Logger, storer Storer) *Core

NewCore constructs a notification core API for use.

func (*Core) Create

func (c *Core) Create(nn NewNotification) (Notification, error)

Create adds a new notification to the system.

func (*Core) CreateTx

func (c *Core) CreateTx(nnTx NewNotificationTx) (Notification, error)

func (*Core) Delete

func (c *Core) Delete(ntf Notification) error

Delete removes the specified notification.

func (*Core) Query

func (c *Core) Query(pageNumber int, rowsPerPage int, topicID uuid.UUID) ([]Notification, error)

Query retrieves a list of notifications.

func (*Core) QueryByID

func (c *Core) QueryByID(id uuid.UUID) (Notification, error)

QueryByID finds the notification by the specified ID.

type NewNotification

type NewNotification struct {
	TopicID uuid.UUID
	Message string
}

NewNotification contains information needed to create a new notification.

type NewNotificationTx

type NewNotificationTx struct {
	NewNotification
	AfterCreate func(ntf Notification) error
}

NewNotificationTx contains information needed to create a new notification in a transaction.

type Notification

type Notification struct {
	ID        uuid.UUID
	TopicID   uuid.UUID
	Message   string
	CreatedAt time.Time
}

Notification represents information about an individual notification.

type Storer

type Storer interface {
	WithinTran(fn func(s Storer) error) error
	Create(ntf Notification) error
	Delete(ntf Notification) error
	Query(pageNumber int, rowsPerPage int, topicID uuid.UUID) ([]Notification, error)
	QueryByID(id uuid.UUID) (Notification, error)
}

Storer interface declares the behavior this package needs to perists and retrieve data.

Directories

Path Synopsis
Package mockntf is a generated GoMock package.
Package mockntf is a generated GoMock package.
Package notificationdb contains notification related CRUD functionality.
Package notificationdb contains notification related CRUD functionality.

Jump to

Keyboard shortcuts

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