Documentation
¶
Index ¶
- Constants
- type ChatProvider
- type EmailProvider
- type MailpitConfig
- type PushProvider
- type SMSProvider
- type Store
- func (s *Store) AddChat(stored *StoredChat)
- func (s *Store) AddEmail(stored *StoredEmail)
- func (s *Store) AddPush(stored *StoredPush)
- func (s *Store) AddSMS(stored *StoredSMS)
- func (s *Store) AllSMS() []*StoredSMS
- func (s *Store) ChatByID(id string) *StoredChat
- func (s *Store) Chats() []*StoredChat
- func (s *Store) Clear()
- func (s *Store) Count() int
- func (s *Store) DeleteChatByID(id string) bool
- func (s *Store) DeleteEmailByID(id string) bool
- func (s *Store) DeletePushByID(id string) bool
- func (s *Store) DeleteSMSByID(id string) bool
- func (s *Store) EmailByID(id string) *StoredEmail
- func (s *Store) Emails() []*StoredEmail
- func (s *Store) PushByID(id string) *StoredPush
- func (s *Store) Pushes() []*StoredPush
- func (s *Store) SMSByID(id string) *StoredSMS
- func (s *Store) Stats() map[string]int
- type StoredChat
- type StoredEmail
- type StoredPush
- type StoredSMS
Constants ¶
const ProviderName = "memory"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatProvider ¶
type ChatProvider struct {
// contains filtered or unexported fields
}
ChatProvider implements port.ChatSender using an in-memory store.
func NewChatProvider ¶
func NewChatProvider(store *Store) *ChatProvider
NewChatProvider creates a new memory chat provider.
func (*ChatProvider) Send ¶
func (c *ChatProvider) Send(ctx context.Context, chat *contracts.ChatMessage) (*contracts.SendResult, error)
Send stores the chat message in memory and returns a success result.
func (*ChatProvider) Store ¶
func (c *ChatProvider) Store() *Store
Store returns the underlying memory store.
type EmailProvider ¶
type EmailProvider struct {
// contains filtered or unexported fields
}
EmailProvider implements port.EmailSender using an in-memory store.
func NewEmailProvider ¶
func NewEmailProvider(store *Store, mailpitCfg MailpitConfig) *EmailProvider
NewEmailProvider creates a new memory email provider.
func (*EmailProvider) Send ¶
func (e *EmailProvider) Send(ctx context.Context, email *contracts.Email) (*contracts.SendResult, error)
Send stores the email in memory and optionally forwards to Mailpit.
func (*EmailProvider) Store ¶
func (e *EmailProvider) Store() *Store
Store returns the underlying memory store.
type MailpitConfig ¶
type MailpitConfig struct {
Enabled bool
}
MailpitConfig holds configuration for SMTP forwarding to Mailpit.
type PushProvider ¶
type PushProvider struct {
// contains filtered or unexported fields
}
PushProvider implements port.PushSender using an in-memory store.
func NewPushProvider ¶
func NewPushProvider(store *Store) *PushProvider
NewPushProvider creates a new memory push provider.
func (*PushProvider) Send ¶
func (p *PushProvider) Send(ctx context.Context, push *contracts.PushNotification) (*contracts.SendResult, error)
Send stores the push notification in memory and returns a success result.
func (*PushProvider) Store ¶
func (p *PushProvider) Store() *Store
Store returns the underlying memory store.
type SMSProvider ¶
type SMSProvider struct {
// contains filtered or unexported fields
}
SMSProvider implements port.SMSSender using an in-memory store.
func NewSMSProvider ¶
func NewSMSProvider(store *Store) *SMSProvider
NewSMSProvider creates a new memory SMS provider.
func (*SMSProvider) Send ¶
func (s *SMSProvider) Send(ctx context.Context, sms *contracts.SMS) (*contracts.SendResult, error)
Send stores the SMS in memory and returns a success result.
func (*SMSProvider) Store ¶
func (s *SMSProvider) Store() *Store
Store returns the underlying memory store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements an in-memory message store for all message types.
func (*Store) AddChat ¶
func (s *Store) AddChat(stored *StoredChat)
AddChat adds a stored chat message.
func (*Store) AddEmail ¶
func (s *Store) AddEmail(stored *StoredEmail)
AddEmail adds a stored email.
func (*Store) AddPush ¶
func (s *Store) AddPush(stored *StoredPush)
AddPush adds a stored push notification.
func (*Store) ChatByID ¶
func (s *Store) ChatByID(id string) *StoredChat
ChatByID returns a stored chat message by its ID, or nil if not found.
func (*Store) Chats ¶
func (s *Store) Chats() []*StoredChat
Chats returns a copy of all stored chat messages.
func (*Store) DeleteChatByID ¶
DeleteChatByID deletes a chat message by ID. Returns true if deleted.
func (*Store) DeleteEmailByID ¶
DeleteEmailByID deletes an email by ID. Returns true if deleted.
func (*Store) DeletePushByID ¶
DeletePushByID deletes a push notification by ID. Returns true if deleted.
func (*Store) DeleteSMSByID ¶
DeleteSMSByID deletes an SMS by ID. Returns true if deleted.
func (*Store) EmailByID ¶
func (s *Store) EmailByID(id string) *StoredEmail
EmailByID returns a stored email by its ID, or nil if not found.
func (*Store) Emails ¶
func (s *Store) Emails() []*StoredEmail
Emails returns a copy of all stored emails.
func (*Store) PushByID ¶
func (s *Store) PushByID(id string) *StoredPush
PushByID returns a stored push notification by its ID, or nil if not found.
func (*Store) Pushes ¶
func (s *Store) Pushes() []*StoredPush
Pushes returns a copy of all stored push notifications.
type StoredChat ¶
type StoredChat struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
Chat *contracts.ChatMessage `json:"chat"`
}
StoredChat wraps a chat message with metadata for storage.
type StoredEmail ¶
type StoredEmail struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
Email *contracts.Email `json:"email"`
}
StoredEmail wraps an email with metadata for storage.
type StoredPush ¶
type StoredPush struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
Push *contracts.PushNotification `json:"push"`
}
StoredPush wraps a push notification with metadata for storage.