Documentation ¶
Index ¶
- Constants
- 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
- type EmailCampaignCreateData
- type EmailCampaignUpdateData
- type EmailWorker
- type IEmailCampaignRepository
- type IEmailMessageRepository
- type IEmailServiceRepository
- type IEmailStatusRepository
- type IEmailSubTagRepository
- type IEmailSubscriberRepository
- type IEmailTemplateRepository
- type IEmailUnSubEventRepository
- type IMobileSubTagRepository
- type IMobileSubscriberRepository
- type IMobileUnSubEventRepository
- type INotificationSubTagRepository
- type INotificationSubscriberRepository
- type INotifierNotificationDriverRepository
- type IRepository
- type ITagRepository
- type IWorker
- type Mailer
- type MobileWorker
- type NotFoundError
- type NotificationWorker
- type NotifierEmailCampaign
- type NotifierEmailCampaignStatus
- type NotifierEmailCampaignTag
- type NotifierEmailCampaignTemplate
- 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
- type NotifierEmailService
- 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
- type NotifierEmailSubscriber
- 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)
- type NotifierEmailUnsubscribeEvent
- type NotifierMobileDriver
- type NotifierMobileSubTag
- type NotifierMobileSubscriber
- 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)
- type NotifierMobileUnsubscribeEvent
- type NotifierNotificationService
- type NotifierNotificationSubTag
- type NotifierNotificationSubscriber
- 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
- type Queue
- type QueueMessage
- type SmtpConfig
- type SmtpMailer
- type WorkerConfig
- type WorkersList
Constants ¶
View Source
const ( MysqlDriver = iota + 1 // Constant representing the MySQL database driver. PostgresDriver // Constant representing the PostgresSQL database driver. )
View Source
const ( NotifierEmailServiceSES = iota + 1 NotifierEmailServiceSendGrid NotifierEmailServiceMailgun NotifierEmailServicePostmark NotifierEmailServiceMailjet NotifierEmailServicePostal NotifierEmailServiceSMTP NotifierEmailServiceSESType = "SES" NotifierEmailServiceSendGridType = "SendGrid" NotifierEmailServiceMailgunType = "MailGun" NotifierEmailServicePostmarkType = "Postmark" NotifierEmailServiceMailjetType = "Mailjet" NotifierEmailServicePostalType = "Postal" NotifierEmailServiceSMTPType = "SMPT" )
View Source
const ( NotifierEmailStatusDraft = iota + 1 NotifierEmailStatusQueued NotifierEmailStatusSending NotifierEmailStatusSent NotifierEmailStatusCanceled NotifierEmailStatusFailed )
View Source
const ( NotifierEmailUnsubBounce = iota + 1 NotifierEmailUnsubComplaint NotifierEmailUnsubManualByAdmin NotifierEmailUnsubManualBySubscriber )
Email Subscriber models
View Source
const (
NotifierMobileServiceKavehNegarType = "KavehNegar" //Iranian provider
)
View Source
const (
NotifierNotificationServiceFirebaseType = "Firebase"
)
Variables ¶
This section is empty.
Functions ¶
func AssignTagsToMobile ¶
func CheckEmailMessageExists ¶
func CheckEmailMessageExists(message *NotifierEmailMessage) error
func CreateEmailMessage ¶
func CreateEmailMessage(message *NotifierEmailMessage) error
func DeleteEmailCampaign ¶
func DeleteEmailTemplate ¶
func DeleteTagByName ¶
func DetachTagsForCampaign ¶
func Initialize ¶
func Initialize(config DbConfig)
func MigrateRollback ¶
func MigrateRollback(config DbConfig)
func RemoveTagsFromEmail ¶
func RemoveTagsFromMobile ¶
func RemoveTagsFromToken ¶
func RemoveToken ¶
func UnSubscribeEmail ¶
func UnSubscribeMobile ¶
func UpdateEmailCampaign ¶
func UpdateEmailCampaign(campaign *NotifierEmailCampaign) error
func UpdateEmailCampaignWithId ¶
func UpdateEmailCampaignWithId(cmpId uint64, data *EmailCampaignUpdateData) error
func UpdateEmailMessage ¶
func UpdateEmailMessage(message *NotifierEmailMessage) error
Types ¶
type EmailCampaignCreateData ¶
type EmailCampaignUpdateData ¶
type IEmailCampaignRepository ¶
type IEmailCampaignRepository interface { IRepository[NotifierEmailCampaign] AssignTagsToCampaign(cmpId uint64, tagsId []uint64) error DeleteAllTagsForCampaign(cmpId uint64) error GetLatestCampaign() (*NotifierEmailCampaign, error) GetCampaignTags(cmpId uint64) []NotifierTag }
func NewGormEmailCampaignRepository ¶
func NewGormEmailCampaignRepository(db *gorm.DB) IEmailCampaignRepository
type IEmailMessageRepository ¶
type IEmailMessageRepository interface { IRepository[NotifierEmailMessage] CheckMessageExists(message *NotifierEmailMessage) error }
func NewGormEmailMessageRepository ¶
func NewGormEmailMessageRepository(db *gorm.DB) IEmailMessageRepository
type IEmailServiceRepository ¶
type IEmailServiceRepository interface { IRepository[NotifierEmailService] }
func NewGormEmailServiceRepository ¶
func NewGormEmailServiceRepository(db *gorm.DB) IEmailServiceRepository
type IEmailStatusRepository ¶
type IEmailStatusRepository interface { IRepository[NotifierEmailCampaignStatus] FirstOrCreate(status *NotifierEmailCampaignStatus) error }
func NewGormEmailStatusRepository ¶
func NewGormEmailStatusRepository(db *gorm.DB) IEmailStatusRepository
type IEmailSubTagRepository ¶
type IEmailSubTagRepository interface { IRepository[NotifierEmailSubTag] }
func NewGormEmailSubTagRepository ¶
func NewGormEmailSubTagRepository(db *gorm.DB) IEmailSubTagRepository
type IEmailSubscriberRepository ¶
type IEmailSubscriberRepository interface { IRepository[NotifierEmailSubscriber] GetByEmail(email string) (*NotifierEmailSubscriber, error) AssignTagToUser(userId uint64, tagsId []uint64) error RemoveTagsFromUser(id uint64, entity []uint64) error GetSubscribersForTag(tagId uint64, data *[]NotifierEmailSubscriber) GetUnSubscribed(data *[]NotifierEmailSubscriber) GetUsersByTagId(tags []NotifierTag, data *[]NotifierEmailSubscriber) GetByEmailWithTags(email string) (*NotifierEmailSubscriber, error) }
func NewGormEmailSubscriberRepository ¶
func NewGormEmailSubscriberRepository(db *gorm.DB) IEmailSubscriberRepository
type IEmailTemplateRepository ¶
type IEmailTemplateRepository interface { IRepository[NotifierEmailCampaignTemplate] }
func NewGormEmailTemplateRepository ¶
func NewGormEmailTemplateRepository(db *gorm.DB) IEmailTemplateRepository
type IEmailUnSubEventRepository ¶
type IEmailUnSubEventRepository interface { IRepository[NotifierEmailUnsubscribeEvent] FirstOrCreate(status *NotifierEmailUnsubscribeEvent) error }
func NewGormEmailUnSubEventRepository ¶
func NewGormEmailUnSubEventRepository(db *gorm.DB) IEmailUnSubEventRepository
type IMobileSubTagRepository ¶
type IMobileSubTagRepository interface { IRepository[NotifierMobileSubTag] }
func NewGormMobileSubTagRepository ¶
func NewGormMobileSubTagRepository(db *gorm.DB) IMobileSubTagRepository
type IMobileSubscriberRepository ¶
type IMobileSubscriberRepository interface { IRepository[NotifierMobileSubscriber] GetByMobile(mobile string) (*NotifierMobileSubscriber, error) AssignTagToUser(userId uint64, tagsId []uint64) error RemoveTagsFromUser(id uint64, entity []uint64) error GetSubscribersForTag(tagId uint64, data []NotifierMobileSubscriber) GetUnSubscribed(data []NotifierMobileSubscriber) }
func NewGormMobileSubscriberRepository ¶
func NewGormMobileSubscriberRepository(db *gorm.DB) IMobileSubscriberRepository
type IMobileUnSubEventRepository ¶
type IMobileUnSubEventRepository interface { IRepository[NotifierMobileUnsubscribeEvent] }
func NewGormMobileUnSubEventRepository ¶
func NewGormMobileUnSubEventRepository(db *gorm.DB) IMobileUnSubEventRepository
type INotificationSubTagRepository ¶
type INotificationSubTagRepository interface { IRepository[NotifierNotificationSubTag] }
func NewGormNotificationSubTagRepository ¶
func NewGormNotificationSubTagRepository(db *gorm.DB) INotificationSubTagRepository
type INotificationSubscriberRepository ¶
type INotificationSubscriberRepository interface { IRepository[NotifierNotificationSubscriber] GetByNotification(token string) (*NotifierNotificationSubscriber, error) AssignTagToUser(userId uint64, tagsId []uint64) error RemoveTagsFromUser(id uint64, entity []uint64) error GetSubscribersForTag(tagId uint64, data []NotifierNotificationSubscriber) GetSubscribersForTagAndDriver(tagId, driverId uint64, data []NotifierNotificationSubscriber) }
func NewGormNotificationSubscriberRepository ¶
func NewGormNotificationSubscriberRepository(db *gorm.DB) INotificationSubscriberRepository
type INotifierNotificationDriverRepository ¶
type INotifierNotificationDriverRepository interface { IRepository[NotifierNotificationService] }
func NewGormNotifierNotificationDriverRepository ¶
func NewGormNotifierNotificationDriverRepository(db *gorm.DB) INotifierNotificationDriverRepository
type IRepository ¶
type ITagRepository ¶
type ITagRepository interface { IRepository[NotifierTag] GetByName(name string) (*NotifierTag, error) }
func NewGormTagRepository ¶
func NewGormTagRepository(db *gorm.DB) ITagRepository
type MobileWorker ¶
type MobileWorker struct { }
func (MobileWorker) Run ¶
func (m MobileWorker) Run()
type NotFoundError ¶
type NotFoundError struct { }
func (NotFoundError) Error ¶
func (n NotFoundError) Error() string
type NotificationWorker ¶
type NotificationWorker struct { }
func (NotificationWorker) Run ¶
func (n NotificationWorker) Run()
type NotifierEmailCampaign ¶
type NotifierEmailCampaign struct { EmailServiceId uint64 ScheduledAt *time.Time TemplateId uint64 UpdatedAt time.Time CreatedAt time.Time StatusId uint64 FromEmail string FromName string Subject string Content string `gorm:"type=longtext"` Name string ID uint64 }
func AddEmailCampaign ¶
func AddEmailCampaign(data *EmailCampaignCreateData) (*NotifierEmailCampaign, error)
func GetLatestCampaignForRun ¶
func GetLatestCampaignForRun() (*NotifierEmailCampaign, error)
type NotifierEmailCampaignStatus ¶
func NewNotifierEmailStatus ¶
func NewNotifierEmailStatus(name string, ID uint64) *NotifierEmailCampaignStatus
type NotifierEmailCampaignTag ¶
func NewNotifierEmailCampaignTag ¶
func NewNotifierEmailCampaignTag(campaignId uint64, tagId uint64) *NotifierEmailCampaignTag
type NotifierEmailCampaignTemplate ¶
type NotifierEmailCampaignTemplate struct { UpdatedAt time.Time CreatedAt time.Time Content string `gorm:"type=longtext"` Name string ID uint64 }
func CreateEmailTemplate ¶
func CreateEmailTemplate(name, content string) (*NotifierEmailCampaignTemplate, error)
func EmailTemplateList ¶
func EmailTemplateList() ([]NotifierEmailCampaignTemplate, error)
func NewNotifierEmailCampaignTemplate ¶
func NewNotifierEmailCampaignTemplate(content string, name string) *NotifierEmailCampaignTemplate
func UpdateEmailTemplate ¶
func UpdateEmailTemplate(id uint64, name, content string) (*NotifierEmailCampaignTemplate, error)
type NotifierEmailMessage ¶
type NotifierEmailMessage struct { RecipientEmail string EmailServiceId uint64 SubscriberId uint64 SourceType string Message string CreatedAt time.Time UpdatedAt time.Time FromEmail string SourceId uint64 FromName string QueuedAt *time.Time FailedAt *time.Time Subject string SentAt *time.Time ID uint64 }
type NotifierEmailService ¶
type NotifierEmailService struct { Payload string `gorm:"type=longtext"` Type string Name string ID uint64 }
func CreateEmailService ¶
func CreateEmailService(name, serviceType string, payload []byte) (*NotifierEmailService, error)
func GetEmailServiceById ¶
func GetEmailServiceById(service uint64) (*NotifierEmailService, error)
func GetEmailServices ¶
func GetEmailServices() ([]NotifierEmailService, error)
func NewNotifierEmailService ¶
func NewNotifierEmailService(payload string, Type string, name string) *NotifierEmailService
type NotifierEmailSubTag ¶
func NewNotifierEmailSubTag ¶
func NewNotifierEmailSubTag(emailSubscriberId uint64, tagId uint64) *NotifierEmailSubTag
type NotifierEmailSubscriber ¶
type NotifierEmailSubscriber struct { UnsubscribedEventId *uint64 Tags []NotifierTag `gorm:"many2many:notifier_email_sub_tags;ForeignKey:id;References:id;JoinForeignKey:EmailSubscriberId;joinReferences:TagId"` UnsubscribedAt *time.Time CreatedAt time.Time UpdatedAt time.Time FirstName string LastName string Email string ID uint64 }
func GetEmailSubscribersWithTags ¶
func GetEmailSubscribersWithTags(tags []NotifierTag) ([]NotifierEmailSubscriber, error)
func GetTagEmailSubscribers ¶
func GetTagEmailSubscribers(tag string) ([]NotifierEmailSubscriber, error)
func GetUnsubscribedEmails ¶
func GetUnsubscribedEmails() ([]NotifierEmailSubscriber, error)
func NewNotifierEmailSubscriber ¶
func NewNotifierEmailSubscriber(email, firstName, lastName string) *NotifierEmailSubscriber
func SubscribeEmail ¶
func SubscribeEmail(email, fName, lName string, tags []string, createTag bool) (*NotifierEmailSubscriber, error)
func (*NotifierEmailSubscriber) Unsubscribable ¶
func (email *NotifierEmailSubscriber) Unsubscribable() bool
type NotifierEmailUnsubscribeEvent ¶
func EmailUnsubscribeEventsList ¶
func EmailUnsubscribeEventsList() ([]NotifierEmailUnsubscribeEvent, error)
func NewNotifierEmailUnsubscribeEvent ¶
func NewNotifierEmailUnsubscribeEvent(reason string, ID uint64) *NotifierEmailUnsubscribeEvent
type NotifierMobileDriver ¶
type NotifierMobileDriver struct { Payload string `gorm:"type=longtext"` Type string Name string ID uint64 }
func NewNotifierMobileDriver ¶
func NewNotifierMobileDriver(payload string, Type string, name string) *NotifierMobileDriver
type NotifierMobileSubTag ¶
func NewNotifierMobileSubTag ¶
func NewNotifierMobileSubTag(mobileSubscriberId uint64, tagId uint64) *NotifierMobileSubTag
type NotifierMobileSubscriber ¶
type NotifierMobileSubscriber struct { UnsubscribedEventId *uint64 UnsubscribedAt *time.Time CountryCode string CreatedAt time.Time UpdatedAt time.Time FirstName string LastName string Mobile string ID uint64 }
func GetTagMobileSubscribers ¶
func GetTagMobileSubscribers(tag string) ([]NotifierMobileSubscriber, error)
func GetUnsubscribedMobiles ¶
func GetUnsubscribedMobiles() ([]NotifierMobileSubscriber, error)
func NewNotifierMobileSubscriber ¶
func NewNotifierMobileSubscriber(countryCode, mobile, firstName, lastName string) *NotifierMobileSubscriber
func SubscribeMobile ¶
func SubscribeMobile(countryCode, mobile, fName, lName string, tags []string, createTag bool) (*NotifierMobileSubscriber, error)
func (*NotifierMobileSubscriber) Unsubscribable ¶
func (mobile *NotifierMobileSubscriber) Unsubscribable() bool
type NotifierMobileUnsubscribeEvent ¶
func MobileUnsubscribeEventsList ¶
func MobileUnsubscribeEventsList() ([]NotifierMobileUnsubscribeEvent, error)
func NewNotifierMobileUnsubscribeEvent ¶
func NewNotifierMobileUnsubscribeEvent(reason string, ID uint64) *NotifierMobileUnsubscribeEvent
type NotifierNotificationService ¶
type NotifierNotificationService struct { Payload string `gorm:"type=longtext"` Type string Name string ID uint64 }
func NewNotifierNotificationService ¶
func NewNotifierNotificationService(payload string, Type string, name string) *NotifierNotificationService
func NotificationDriversList ¶
func NotificationDriversList() ([]NotifierNotificationService, error)
type NotifierNotificationSubTag ¶
func NewNotifierNotificationSubTag ¶
func NewNotifierNotificationSubTag(notificationSubscriberId uint64, tagId uint64) *NotifierNotificationSubTag
type NotifierNotificationSubscriber ¶
type NotifierNotificationSubscriber struct { CreatedAt time.Time UpdatedAt time.Time FirstName string LastName string DriverId uint64 Token string ID uint64 }
func AddNewToken ¶
func GetTagAndDriverTokenSubscribers ¶
func GetTagAndDriverTokenSubscribers(tag string, driverId uint64) ([]NotifierNotificationSubscriber, error)
func GetTagTokenSubscribers ¶
func GetTagTokenSubscribers(tag string) ([]NotifierNotificationSubscriber, error)
func NewNotifierNotificationSubscriber ¶
func NewNotifierNotificationSubscriber(token, firstName, lastName string, driverId uint64) *NotifierNotificationSubscriber
type NotifierTag ¶
func CreateTag ¶
func CreateTag(name string) (*NotifierTag, error)
func GetEmailCampaignTags ¶
func GetEmailCampaignTags(cmpId uint64) []NotifierTag
func GetTagByName ¶
func GetTagByName(name string) (*NotifierTag, error)
func NewNotifierTag ¶
func NewNotifierTag(name string) *NotifierTag
func TagsList ¶
func TagsList() ([]NotifierTag, error)
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) CloseWorker ¶
func (q *Queue) CloseWorker()
func (*Queue) Send ¶
func (q *Queue) Send(data *QueueMessage)
func (*Queue) StartListening ¶
func (q *Queue) StartListening()
type QueueMessage ¶
type QueueMessage struct {
// contains filtered or unexported fields
}
func NewQueueMessage ¶
func NewQueueMessage(handle func(data any) error, data interface{}) *QueueMessage
type SmtpConfig ¶
type SmtpMailer ¶
type SmtpMailer struct {
// contains filtered or unexported fields
}
func (*SmtpMailer) Send ¶
func (s *SmtpMailer) Send(fromName, fromMail, to, subject, message string) error
func (*SmtpMailer) SetConfig ¶
func (s *SmtpMailer) SetConfig(config []byte)
type WorkersList ¶
type WorkersList []WorkerConfig
Source Files ¶
Click to show internal directories.
Click to hide internal directories.