(cb func(ctx context.Context, payload InboxNotificationEvent, err error))
| 16 | } |
| 17 | |
| 18 | func 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 | |
| 34 | type InboxNotificationEvent struct { |
| 35 | Kind InboxNotificationEventKind `json:"kind"` |
no test coverage detected