Documentation ¶
Index ¶
- Constants
- func AddTo(ctx *gin.Context, notificationHandlers *NotificationHandlers)
- type NotificationHandlers
- func (n *NotificationHandlers) GetNewNotificationsForUser(userID persist.DBID) chan db.Notification
- func (n *NotificationHandlers) GetUpdatedNotificationsForUser(userID persist.DBID) chan db.Notification
- func (n *NotificationHandlers) UnsubscribeNewNotificationsForUser(userID persist.DBID)
- func (n *NotificationHandlers) UnsubscribeUpdatedNotificationsForUser(userID persist.DBID)
- type UserFacingNotificationData
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 For(ctx context.Context) *NotificationHandlers
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 ¶
func (u UserFacingNotificationData) String() string
Click to show internal directories.
Click to hide internal directories.