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 ¶
const ( SeverityInfo = 0 SeverityWarning = 1 SeverityError = 2 )
Severity levels for inbox messages
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 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 ¶
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.