Documentation ¶
Index ¶
- func NewHTTPSender(client *http.Client, cfg alert.Config, url string) alert.Sender
- func NewHTTPSenderWithDefault(cfg alert.Config) alert.Sender
- func NewRepository(db middleware.Pool) alert.Repository
- func NewRepositoryWithGlobal() alert.Repository
- func NewSMTPSender(client *smtp.Client, cfg alert.Config, url string) alert.Sender
- func NewSMTPSenderWithDefault(cfg alert.Config) (alert.Sender, error)
- func NewService(repository alert.Repository, config alert.Config) alert.Service
- func NewServiceWithDefault(config alert.Config) alert.Service
- type Config
- type HTTPSender
- type Repository
- type Response
- type SMTPSender
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPSender ¶
NewHTTPSender returns a new alert.Sender
func NewHTTPSenderWithDefault ¶
NewHTTPSenderWithDefault returns a new alert.Sender with default http client
func NewRepository ¶
func NewRepository(db middleware.Pool) alert.Repository
NewRepository returns *Repository with given middleware.Pool
func NewRepositoryWithGlobal ¶
func NewRepositoryWithGlobal() alert.Repository
NewRepositoryWithGlobal returns *Repository with global mysql pool
func NewSMTPSender ¶
NewSMTPSender returns a new alert.Sender
func NewSMTPSenderWithDefault ¶
NewSMTPSenderWithDefault returns a new alert.Sender with default SMTP client
func NewService ¶
NewService returns a new alert.Service
Types ¶
type Config ¶
func NewConfigFromFile ¶
func NewConfigFromFile() Config
NewConfigFromFile returns a new Config which reads data from config file
type HTTPSender ¶
type HTTPSender struct {
// contains filtered or unexported fields
}
func (*HTTPSender) GetClient ¶
func (hs *HTTPSender) GetClient() *http.Client
GetClient returns the http client
func (*HTTPSender) GetConfig ¶
func (hs *HTTPSender) GetConfig() alert.Config
GetConfig return the config
func (*HTTPSender) Send ¶
func (hs *HTTPSender) Send() error
Send sends the email via http api calling
type Repository ¶
type Repository struct {
Database middleware.Pool
}
func (*Repository) Execute ¶
func (r *Repository) Execute(command string, args ...interface{}) (middleware.Result, error)
Execute executes given command and placeholders on the middleware
func (*Repository) Save ¶
func (r *Repository) Save(url, toAddrs, ccAddrs, subject, content, config, message string) error
Save saves sending result into the middleware
func (*Repository) Transaction ¶
func (r *Repository) Transaction() (middleware.Transaction, error)
Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
type Response ¶
func NewEmptyResponse ¶
func NewEmptyResponse() *Response
NewEmptyResponse returns a new empty *Response
type SMTPSender ¶
type SMTPSender struct {
// contains filtered or unexported fields
}
func (*SMTPSender) GetClient ¶
func (ss *SMTPSender) GetClient() *smtp.Client
GetClient returns the smtp client
func (*SMTPSender) GetConfig ¶
func (ss *SMTPSender) GetConfig() alert.Config
GetConfig returns the config
func (*SMTPSender) Send ¶
func (ss *SMTPSender) Send() error
Send sends the email via the api calling
type Service ¶
type Service struct { alert.Repository // contains filtered or unexported fields }
func (*Service) GetRepository ¶
func (s *Service) GetRepository() alert.Repository
GetRepository returns the repository of the service