MCPcopy Index your code
hub / github.com/coder/coder / HandleInboxNotificationEvent

Function HandleInboxNotificationEvent

coderd/pubsub/inboxnotification.go:18–32  ·  view source on GitHub ↗
(cb func(ctx context.Context, payload InboxNotificationEvent, err error))

Source from the content-addressed store, hash-verified

16}
17
18func HandleInboxNotificationEvent(cb func(ctx context.Context, payload InboxNotificationEvent, err error)) func(ctx context.Context, message []byte, err error) {
19 return func(ctx context.Context, message []byte, err error) {
20 if err != nil {
21 cb(ctx, InboxNotificationEvent{}, xerrors.Errorf("inbox notification event pubsub: %w", err))
22 return
23 }
24 var payload InboxNotificationEvent
25 if err := json.Unmarshal(message, &payload); err != nil {
26 cb(ctx, InboxNotificationEvent{}, xerrors.Errorf("unmarshal inbox notification event"))
27 return
28 }
29
30 cb(ctx, payload, err)
31 }
32}
33
34type InboxNotificationEvent struct {
35 Kind InboxNotificationEventKind `json:"kind"`

Callers 1

Calls 2

ErrorfMethod · 0.45
UnmarshalMethod · 0.45

Tested by

no test coverage detected