Versions in this module Expand all Collapse all v1 v1.0.3 Jul 26, 2023 v1.0.1 Jul 25, 2023 Changes in this version + const MysqlDriver + const NotifierEmailServiceMailgun + const NotifierEmailServiceMailgunType + const NotifierEmailServiceMailjet + const NotifierEmailServiceMailjetType + const NotifierEmailServicePostal + const NotifierEmailServicePostalType + const NotifierEmailServicePostmark + const NotifierEmailServicePostmarkType + const NotifierEmailServiceSES + const NotifierEmailServiceSESType + const NotifierEmailServiceSMTP + const NotifierEmailServiceSMTPType + const NotifierEmailServiceSendGrid + const NotifierEmailServiceSendGridType + const NotifierEmailStatusCanceled + const NotifierEmailStatusDraft + const NotifierEmailStatusFailed + const NotifierEmailStatusQueued + const NotifierEmailStatusSending + const NotifierEmailStatusSent + const NotifierEmailUnsubBounce + const NotifierEmailUnsubComplaint + const NotifierEmailUnsubManualByAdmin + const NotifierEmailUnsubManualBySubscriber + const NotifierMobileServiceKavehNegarType + const NotifierNotificationServiceFirebaseType + const PostgresDriver + func AssignTagsToEmail(email string, tags []string, createTag bool) error + func AssignTagsToMobile(mobile string, tags []string, createTag bool) error + func AssignTagsToToken(token string, tags []string, createTag bool) error + func CheckEmailMessageExists(message *NotifierEmailMessage) error + func CreateEmailMessage(message *NotifierEmailMessage) error + func DeleteEmailCampaign(campaign uint64) error + func DeleteEmailTemplate(id uint64) error + func DeleteTagByName(name string) error + func DetachTagsForCampaign(campaign uint64) error + func Initialize(config DbConfig) + func Migrate(config DbConfig) + func MigrateRollback(config DbConfig) + func RemoveTagsFromEmail(email string, tags []string) error + func RemoveTagsFromMobile(mobile string, tags []string) error + func RemoveTagsFromToken(token string, tags []string) error + func RemoveToken(token string) error + func Seed() error + func UnSubscribeEmail(email string, unsubId uint64) error + func UnSubscribeMobile(mobile string, unsubId uint64) error + func UpdateEmailCampaign(campaign *NotifierEmailCampaign) error + func UpdateEmailCampaignWithId(cmpId uint64, data *EmailCampaignUpdateData) error + func UpdateEmailMessage(message *NotifierEmailMessage) error + func WorkerStart(config WorkersList) + type DbConfig struct + DB string + Driver int + Host string + Name string + Password string + Port string + Username string + type EmailCampaignCreateData struct + EmailServiceId uint64 + FromEmail string + FromName string + Name string + ScheduledAt *time.Time + StatusId uint64 + Subject string + Tags []uint64 + TemplateId uint64 + type EmailCampaignUpdateData struct + EmailServiceId uint64 + FromEmail string + FromName string + Name string + ScheduledAt *time.Time + StatusId uint64 + Subject string + Tags []uint64 + TemplateId uint64 + type EmailWorker struct + func (e EmailWorker) Run() + type IEmailCampaignRepository interface + AssignTagsToCampaign func(cmpId uint64, tagsId []uint64) error + DeleteAllTagsForCampaign func(cmpId uint64) error + GetCampaignTags func(cmpId uint64) []NotifierTag + GetLatestCampaign func() (*NotifierEmailCampaign, error) + func NewGormEmailCampaignRepository(db *gorm.DB) IEmailCampaignRepository + type IEmailMessageRepository interface + CheckMessageExists func(message *NotifierEmailMessage) error + func NewGormEmailMessageRepository(db *gorm.DB) IEmailMessageRepository + type IEmailServiceRepository interface + func NewGormEmailServiceRepository(db *gorm.DB) IEmailServiceRepository + type IEmailStatusRepository interface + FirstOrCreate func(status *NotifierEmailCampaignStatus) error + func NewGormEmailStatusRepository(db *gorm.DB) IEmailStatusRepository + type IEmailSubTagRepository interface + func NewGormEmailSubTagRepository(db *gorm.DB) IEmailSubTagRepository + type IEmailSubscriberRepository interface + AssignTagToUser func(userId uint64, tagsId []uint64) error + GetByEmail func(email string) (*NotifierEmailSubscriber, error) + GetByEmailWithTags func(email string) (*NotifierEmailSubscriber, error) + GetSubscribersForTag func(tagId uint64, data *[]NotifierEmailSubscriber) + GetUnSubscribed func(data *[]NotifierEmailSubscriber) + GetUsersByTagId func(tags []NotifierTag, data *[]NotifierEmailSubscriber) + RemoveTagsFromUser func(id uint64, entity []uint64) error + func NewGormEmailSubscriberRepository(db *gorm.DB) IEmailSubscriberRepository + type IEmailTemplateRepository interface + func NewGormEmailTemplateRepository(db *gorm.DB) IEmailTemplateRepository + type IEmailUnSubEventRepository interface + FirstOrCreate func(status *NotifierEmailUnsubscribeEvent) error + func NewGormEmailUnSubEventRepository(db *gorm.DB) IEmailUnSubEventRepository + type IMobileSubTagRepository interface + func NewGormMobileSubTagRepository(db *gorm.DB) IMobileSubTagRepository + type IMobileSubscriberRepository interface + AssignTagToUser func(userId uint64, tagsId []uint64) error + GetByMobile func(mobile string) (*NotifierMobileSubscriber, error) + GetSubscribersForTag func(tagId uint64, data []NotifierMobileSubscriber) + GetUnSubscribed func(data []NotifierMobileSubscriber) + RemoveTagsFromUser func(id uint64, entity []uint64) error + func NewGormMobileSubscriberRepository(db *gorm.DB) IMobileSubscriberRepository + type IMobileUnSubEventRepository interface + func NewGormMobileUnSubEventRepository(db *gorm.DB) IMobileUnSubEventRepository + type INotificationSubTagRepository interface + func NewGormNotificationSubTagRepository(db *gorm.DB) INotificationSubTagRepository + type INotificationSubscriberRepository interface + AssignTagToUser func(userId uint64, tagsId []uint64) error + GetByNotification func(token string) (*NotifierNotificationSubscriber, error) + GetSubscribersForTag func(tagId uint64, data []NotifierNotificationSubscriber) + GetSubscribersForTagAndDriver func(tagId, driverId uint64, data []NotifierNotificationSubscriber) + RemoveTagsFromUser func(id uint64, entity []uint64) error + func NewGormNotificationSubscriberRepository(db *gorm.DB) INotificationSubscriberRepository + type INotifierNotificationDriverRepository interface + func NewGormNotifierNotificationDriverRepository(db *gorm.DB) INotifierNotificationDriverRepository + type IRepository interface + All func(data *[]Model) + Create func(*Model) error + Delete func(*Model) error + Get func(id uint64) (*Model, error) + Update func(*Model) error + type ITagRepository interface + GetByName func(name string) (*NotifierTag, error) + func NewGormTagRepository(db *gorm.DB) ITagRepository + type IWorker interface + Run func() + type Mailer interface + Send func(fromName, fromMail, to, subject, message string) error + SetConfig func(config []byte) + type MobileWorker struct + func (m MobileWorker) Run() + type NotFoundError struct + func (n NotFoundError) Error() string + type NotificationWorker struct + func (n NotificationWorker) Run() + type NotifierEmailCampaign struct + Content string + CreatedAt time.Time + EmailServiceId uint64 + FromEmail string + FromName string + ID uint64 + Name string + ScheduledAt *time.Time + StatusId uint64 + Subject string + TemplateId uint64 + UpdatedAt time.Time + func AddEmailCampaign(data *EmailCampaignCreateData) (*NotifierEmailCampaign, error) + func GetLatestCampaignForRun() (*NotifierEmailCampaign, error) + func NewNotifierEmailCampaign(emailServiceId uint64, scheduledAt *time.Time, templateId uint64, ...) *NotifierEmailCampaign + type NotifierEmailCampaignStatus struct + ID uint64 + Name string + func NewNotifierEmailStatus(name string, ID uint64) *NotifierEmailCampaignStatus + type NotifierEmailCampaignTag struct + CampaignId uint64 + TagId uint64 + func NewNotifierEmailCampaignTag(campaignId uint64, tagId uint64) *NotifierEmailCampaignTag + type NotifierEmailCampaignTemplate struct + Content string + CreatedAt time.Time + ID uint64 + Name string + UpdatedAt time.Time + func CreateEmailTemplate(name, content string) (*NotifierEmailCampaignTemplate, error) + func EmailTemplateList() ([]NotifierEmailCampaignTemplate, error) + func NewNotifierEmailCampaignTemplate(content string, name string) *NotifierEmailCampaignTemplate + func UpdateEmailTemplate(id uint64, name, content string) (*NotifierEmailCampaignTemplate, error) + type NotifierEmailMessage struct + CreatedAt time.Time + EmailServiceId uint64 + FailedAt *time.Time + FromEmail string + FromName string + ID uint64 + Message string + QueuedAt *time.Time + RecipientEmail string + SentAt *time.Time + SourceId uint64 + SourceType string + Subject string + SubscriberId uint64 + UpdatedAt time.Time + func NewNotifierEmailMessage(recipientEmail string, subscriberId uint64, sourceType string, ...) *NotifierEmailMessage + type NotifierEmailService struct + ID uint64 + Name string + Payload string + Type string + func CreateEmailService(name, serviceType string, payload []byte) (*NotifierEmailService, error) + func GetEmailServiceById(service uint64) (*NotifierEmailService, error) + func GetEmailServices() ([]NotifierEmailService, error) + func NewNotifierEmailService(payload string, Type string, name string) *NotifierEmailService + type NotifierEmailSubTag struct + EmailSubscriberId uint64 + TagId uint64 + func NewNotifierEmailSubTag(emailSubscriberId uint64, tagId uint64) *NotifierEmailSubTag + type NotifierEmailSubscriber struct + CreatedAt time.Time + Email string + FirstName string + ID uint64 + LastName string + Tags []NotifierTag + UnsubscribedAt *time.Time + UnsubscribedEventId *uint64 + UpdatedAt time.Time + func GetEmailSubscribersWithTags(tags []NotifierTag) ([]NotifierEmailSubscriber, error) + func GetTagEmailSubscribers(tag string) ([]NotifierEmailSubscriber, error) + func GetUnsubscribedEmails() ([]NotifierEmailSubscriber, error) + func NewNotifierEmailSubscriber(email, firstName, lastName string) *NotifierEmailSubscriber + func SubscribeEmail(email, fName, lName string, tags []string, createTag bool) (*NotifierEmailSubscriber, error) + func (email *NotifierEmailSubscriber) Unsubscribable() bool + type NotifierEmailUnsubscribeEvent struct + ID uint64 + Reason string + func EmailUnsubscribeEventsList() ([]NotifierEmailUnsubscribeEvent, error) + func NewNotifierEmailUnsubscribeEvent(reason string, ID uint64) *NotifierEmailUnsubscribeEvent + type NotifierMobileDriver struct + ID uint64 + Name string + Payload string + Type string + func NewNotifierMobileDriver(payload string, Type string, name string) *NotifierMobileDriver + type NotifierMobileSubTag struct + MobileSubscriberId uint64 + TagId uint64 + func NewNotifierMobileSubTag(mobileSubscriberId uint64, tagId uint64) *NotifierMobileSubTag + type NotifierMobileSubscriber struct + CountryCode string + CreatedAt time.Time + FirstName string + ID uint64 + LastName string + Mobile string + UnsubscribedAt *time.Time + UnsubscribedEventId *uint64 + UpdatedAt time.Time + func GetTagMobileSubscribers(tag string) ([]NotifierMobileSubscriber, error) + func GetUnsubscribedMobiles() ([]NotifierMobileSubscriber, error) + func NewNotifierMobileSubscriber(countryCode, mobile, firstName, lastName string) *NotifierMobileSubscriber + func SubscribeMobile(countryCode, mobile, fName, lName string, tags []string, createTag bool) (*NotifierMobileSubscriber, error) + func (mobile *NotifierMobileSubscriber) Unsubscribable() bool + type NotifierMobileUnsubscribeEvent struct + ID uint64 + Reason string + func MobileUnsubscribeEventsList() ([]NotifierMobileUnsubscribeEvent, error) + func NewNotifierMobileUnsubscribeEvent(reason string, ID uint64) *NotifierMobileUnsubscribeEvent + type NotifierNotificationService struct + ID uint64 + Name string + Payload string + Type string + func NewNotifierNotificationService(payload string, Type string, name string) *NotifierNotificationService + func NotificationDriversList() ([]NotifierNotificationService, error) + type NotifierNotificationSubTag struct + NotificationSubscriberId uint64 + TagId uint64 + func NewNotifierNotificationSubTag(notificationSubscriberId uint64, tagId uint64) *NotifierNotificationSubTag + type NotifierNotificationSubscriber struct + CreatedAt time.Time + DriverId uint64 + FirstName string + ID uint64 + LastName string + Token string + UpdatedAt time.Time + func AddNewToken(token, fName, lName string, driverId uint64, tags []string, createTag bool) (*NotifierNotificationSubscriber, error) + func GetTagAndDriverTokenSubscribers(tag string, driverId uint64) ([]NotifierNotificationSubscriber, error) + func GetTagTokenSubscribers(tag string) ([]NotifierNotificationSubscriber, error) + func NewNotifierNotificationSubscriber(token, firstName, lastName string, driverId uint64) *NotifierNotificationSubscriber + type NotifierTag struct + CreatedAt time.Time + ID uint64 + Name string + UpdatedAt time.Time + func CreateTag(name string) (*NotifierTag, error) + func GetEmailCampaignTags(cmpId uint64) []NotifierTag + func GetTagByName(name string) (*NotifierTag, error) + func NewNotifierTag(name string) *NotifierTag + func TagsList() ([]NotifierTag, error) + type Queue struct + func NewQueue(name string) *Queue + func (q *Queue) CloseWorker() + func (q *Queue) Send(data *QueueMessage) + func (q *Queue) StartListening() + type QueueMessage struct + func NewQueueMessage(handle func(data any) error, data interface{}) *QueueMessage + type SmtpConfig struct + Encryption string + Host string + Password string + Port string + Username string + type SmtpMailer struct + func (s *SmtpMailer) Send(fromName, fromMail, to, subject, message string) error + func (s *SmtpMailer) SetConfig(config []byte) + type WorkerConfig struct + Duration time.Duration + Name string + Worker IWorker + type WorkersList []WorkerConfig