Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Config = &NotifierConfig{
DSN: "amqp://guest:guest@localhost:5672/",
Exchange: "test",
}
Functions ¶
This section is empty.
Types ¶
type EmailSettings ¶
type MockPublisher ¶
func (*MockPublisher) Close ¶
func (m *MockPublisher) Close() error
Close mocks the Close method of *rabbitmq.Channel.
func (*MockPublisher) PublishWithContext ¶
func (m *MockPublisher) PublishWithContext( ctx context.Context, data []byte, routingKeys []string, optionFuncs ...func(options *rabbitmq.PublisherOptions)) error
Publish mocks the Publish method of *rabbitmq.Channel.
type NotificationPayload ¶
type NotificationPayload struct { Type string `json:"type"` Data interface{} `json:"data"` EmailSettings EmailSettings `json:"email_setting,omitempty"` PhoneSettings PhoneSettings `json:"phone_setting,omitempty"` PushSettings PushSettings `json:"push_settings,omitempty"` }
func NewNotification ¶
func NewNotification(opts ...Option) NotificationPayload
type NotifierClient ¶
type NotifierClient struct {
// contains filtered or unexported fields
}
func NewNotifierClient ¶
func NewNotifierClient(cfg *NotifierConfig) (*NotifierClient, error)
func (*NotifierClient) Close ¶
func (n *NotifierClient) Close() error
func (*NotifierClient) Notify ¶
func (n *NotifierClient) Notify(ctx context.Context, payload *NotificationPayload) error
type NotifierConfig ¶
type Option ¶
type Option func(o *options)
func WithEmailSettings ¶
func WithEmailSettings(s EmailSettings) Option
func WithPhoneSettings ¶
func WithPhoneSettings(s PhoneSettings) Option
type PhoneSettings ¶
type PushSettings ¶
type PushSettings struct { To string `json:"to"` // Must be unique identifier for each user, for example user_id Image string `json:"image,omitempty"` // Must be valid direct link to image Title string `json:"title,omitempty"` Message string `json:"message,omitempty"` Template string `json:"template,omitempty"` Data interface{} `json:"data,omitempty"` }
Click to show internal directories.
Click to hide internal directories.