notifications

package
v0.0.0-...-9183981 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const NotificationHandlerContextKey = "notification.notificationHandlers"

Variables

This section is empty.

Functions

func AddTo

func AddTo(ctx *gin.Context, notificationHandlers *NotificationHandlers)

Register specific notification handlers

Types

type NotificationHandlers

type NotificationHandlers struct {
	Notifications            *notificationDispatcher
	UserNewNotifications     map[persist.DBID]chan db.Notification
	UserUpdatedNotifications map[persist.DBID]chan db.Notification
	// contains filtered or unexported fields
}

func For

func New

func New(queries *db.Queries, pub *pubsub.Client, taskClient *task.Client, lock *redislock.Client, listen bool) *NotificationHandlers

New registers specific notification handlers

func (*NotificationHandlers) GetNewNotificationsForUser

func (n *NotificationHandlers) GetNewNotificationsForUser(userID persist.DBID) chan db.Notification

func (*NotificationHandlers) GetUpdatedNotificationsForUser

func (n *NotificationHandlers) GetUpdatedNotificationsForUser(userID persist.DBID) chan db.Notification

func (*NotificationHandlers) UnsubscribeNewNotificationsForUser

func (n *NotificationHandlers) UnsubscribeNewNotificationsForUser(userID persist.DBID)

func (*NotificationHandlers) UnsubscribeUpdatedNotificationsForUser

func (n *NotificationHandlers) UnsubscribeUpdatedNotificationsForUser(userID persist.DBID)

type UserFacingNotificationData

type UserFacingNotificationData struct {
	Actor          string       `json:"actor"`
	Action         string       `json:"action"`
	CollectionName string       `json:"collectionName"`
	CollectionID   persist.DBID `json:"collectionId"`
	PreviewText    string       `json:"previewText"`
}

func NotificationToUserFacingData

func NotificationToUserFacingData(ctx context.Context, queries *coredb.Queries, n coredb.Notification) (UserFacingNotificationData, error)

func (UserFacingNotificationData) String

Jump to

Keyboard shortcuts

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