Documentation
¶
Index ¶
- Variables
- type Clock
- type EmailSender
- type Notification
- type NotifyInput
- type NotifyService
- func (s *NotifyService) Archive(ctx context.Context, userID, id string) error
- func (s *NotifyService) Badge(ctx context.Context, userID string) (int, error)
- func (s *NotifyService) Inbox(ctx context.Context, userID string, limit int) ([]Notification, error)
- func (s *NotifyService) ListPreferences(ctx context.Context, userID string) ([]Preference, error)
- func (s *NotifyService) MarkAllRead(ctx context.Context, userID string) error
- func (s *NotifyService) MarkRead(ctx context.Context, userID, id string) error
- func (s *NotifyService) Notify(ctx context.Context, input NotifyInput) error
- func (s *NotifyService) NotifyOncePerMonth(ctx context.Context, input NotifyInput) error
- func (s *NotifyService) SendEmail(ctx context.Context, to, subject, body string) error
- func (s *NotifyService) SendTypeEmail(ctx context.Context, userID, typ, to, subject, body string) error
- func (s *NotifyService) UpsertPreference(ctx context.Context, userID, typ string, email, inApp *bool) (Preference, error)
- func (s *NotifyService) WithPrefGate(gate PrefGate) *NotifyService
- type PrefGate
- type Preference
- type Repo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type EmailSender ¶
type Notification ¶
type NotifyInput ¶
type NotifyService ¶
type NotifyService struct {
// contains filtered or unexported fields
}
func NewNotifyService ¶
func NewNotifyService(repo Repo, mail EmailSender, now Clock) *NotifyService
func (*NotifyService) Archive ¶
func (s *NotifyService) Archive(ctx context.Context, userID, id string) error
func (*NotifyService) Inbox ¶
func (s *NotifyService) Inbox(ctx context.Context, userID string, limit int) ([]Notification, error)
func (*NotifyService) ListPreferences ¶
func (s *NotifyService) ListPreferences(ctx context.Context, userID string) ([]Preference, error)
func (*NotifyService) MarkAllRead ¶
func (s *NotifyService) MarkAllRead(ctx context.Context, userID string) error
func (*NotifyService) MarkRead ¶
func (s *NotifyService) MarkRead(ctx context.Context, userID, id string) error
func (*NotifyService) Notify ¶
func (s *NotifyService) Notify(ctx context.Context, input NotifyInput) error
func (*NotifyService) NotifyOncePerMonth ¶
func (s *NotifyService) NotifyOncePerMonth(ctx context.Context, input NotifyInput) error
func (*NotifyService) SendEmail ¶
func (s *NotifyService) SendEmail(ctx context.Context, to, subject, body string) error
func (*NotifyService) SendTypeEmail ¶
func (s *NotifyService) SendTypeEmail(ctx context.Context, userID, typ, to, subject, body string) error
func (*NotifyService) UpsertPreference ¶
func (s *NotifyService) UpsertPreference(ctx context.Context, userID, typ string, email, inApp *bool) (Preference, error)
func (*NotifyService) WithPrefGate ¶
func (s *NotifyService) WithPrefGate(gate PrefGate) *NotifyService
type PrefGate ¶
type PrefGate interface {
List(ctx context.Context, userID string) ([]Preference, error)
Upsert(ctx context.Context, userID, typ string, email, inApp *bool) (Preference, error)
Allowed(ctx context.Context, userID, typ string) (bool, error)
EmailAllowed(ctx context.Context, userID, typ string) (bool, error)
}
type Preference ¶
type Repo ¶
type Repo interface {
Insert(ctx context.Context, n NotifyInput, now time.Time) (isNew bool, err error)
ListInbox(ctx context.Context, userID string, limit int) ([]Notification, error)
UnreadCount(ctx context.Context, userID string) (int, error)
MarkRead(ctx context.Context, userID, notificationID string) error
MarkAllRead(ctx context.Context, userID string) error
Archive(ctx context.Context, userID, notificationID string) error
}
Click to show internal directories.
Click to hide internal directories.