inbox

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package inbox provides a service for managing persistent system notifications.

The InboxService combines database storage with real-time notifications, ensuring that when an inbox message is added, connected API clients are immediately notified with the full message details.

Index

Constants

View Source
const (
	SeverityInfo    = 0
	SeverityWarning = 1
	SeverityError   = 2
)

Severity levels for inbox messages

View Source
const (
	CategoryNone = "" // No deduplication
)

Category constants for deduplication

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageOption

type MessageOption func(*MessageOptions)

MessageOption is a functional option for configuring inbox messages.

func WithBody

func WithBody(body string) MessageOption

WithBody sets the message body.

func WithCategory

func WithCategory(category string) MessageOption

WithCategory sets the category for deduplication. Messages with the same category and profileID will be updated instead of duplicated.

func WithProfileID

func WithProfileID(profileID int64) MessageOption

WithProfileID sets the profile ID for profile-specific messages. Use 0 for global messages visible to all profiles.

func WithSeverity

func WithSeverity(severity int) MessageOption

WithSeverity sets the message severity level.

type MessageOptions

type MessageOptions struct {
	Body      string
	Category  string
	Severity  int
	ProfileID int64
}

MessageOptions configures optional fields for inbox messages.

type Service

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

Service manages inbox messages with automatic notification broadcasting.

func NewService

func NewService(db database.UserDBI, ns chan<- models.Notification) *Service

NewService creates a new inbox service.

func (*Service) Add

func (s *Service) Add(title string, opts ...MessageOption) error

Add creates a new inbox message or updates an existing one (if category is set). Connected clients are notified with the full message details.

Jump to

Keyboard shortcuts

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