Documentation
¶
Index ¶
- Constants
- Variables
- func DbModels() []interface{}
- func QueryDbModels() []interface{}
- type Provider
- type ProviderBase
- type ProviderFactory
- type ProviderResponse
- type SmsDestination
- type SmsDestinationConfig
- type SmsManager
- type SmsManagerBase
- func (s *SmsManagerBase) AttachToErrorManager(errManager generic_error.ErrorManager)
- func (s *SmsManagerBase) Config() interface{}
- func (s *SmsManagerBase) Db(ctx op_context.Context) db.DBHandlers
- func (s *SmsManagerBase) FindSms(ctx op_context.Context, smsId string) (*SmsMessage, error)
- func (s *SmsManagerBase) Init(cfg config.Config, log logger.Logger, vld validator.Validator, ...) error
- func (s *SmsManagerBase) InitDbService(ctx op_context.Context, poool pool.Pool, role string) error
- func (s *SmsManagerBase) Send(ctx auth.UserContext, message string, recipient string) (string, error)
- type SmsManagerBaseConfig
- type SmsMessage
Constants ¶
View Source
const ( StatusSending string = "sending" StatusSuccess string = "success" StatusFail string = "fail" )
View Source
const (
ErrorCodeSmsSendingFailed string = "sms_sending_failed"
)
Variables ¶
View Source
var SmsErrorDescriptions = map[string]string{ ErrorCodeSmsSendingFailed: "Failed to send SMS", }
View Source
var SmsErrorHttpCodes = map[string]int{ ErrorCodeSmsSendingFailed: http.StatusInternalServerError, }
Functions ¶
func QueryDbModels ¶
func QueryDbModels() []interface{}
Types ¶
type Provider ¶
type Provider interface { object_config.Subobject Send(ctx op_context.Context, message string, recipient string, smsID ...string) (*ProviderResponse, error) }
type ProviderBase ¶
type ProviderBase struct { object_config.WithProtocolBase common.WithNameBase }
func (*ProviderBase) SetProtocolAndName ¶
func (p *ProviderBase) SetProtocolAndName(protocol string, name ...string)
type ProviderFactory ¶
type ProviderResponse ¶
type SmsDestination ¶
type SmsDestination struct { SmsDestinationConfig // contains filtered or unexported fields }
func (*SmsDestination) Config ¶
func (s *SmsDestination) Config() interface{}
type SmsDestinationConfig ¶
type SmsManager ¶
type SmsManager interface { generic_error.ErrorDefinitions Send(ctx auth.UserContext, message string, recipient string) (string, error) FindSms(ctx op_context.Context, smsId string) (*SmsMessage, error) }
type SmsManagerBase ¶
type SmsManagerBase struct { SmsManagerBaseConfig // contains filtered or unexported fields }
func NewSmsManager ¶
func NewSmsManager() *SmsManagerBase
func (*SmsManagerBase) AttachToErrorManager ¶
func (s *SmsManagerBase) AttachToErrorManager(errManager generic_error.ErrorManager)
func (*SmsManagerBase) Config ¶
func (s *SmsManagerBase) Config() interface{}
func (*SmsManagerBase) Db ¶
func (s *SmsManagerBase) Db(ctx op_context.Context) db.DBHandlers
func (*SmsManagerBase) FindSms ¶
func (s *SmsManagerBase) FindSms(ctx op_context.Context, smsId string) (*SmsMessage, error)
func (*SmsManagerBase) Init ¶
func (s *SmsManagerBase) Init(cfg config.Config, log logger.Logger, vld validator.Validator, factory ProviderFactory, configPath ...string) error
func (*SmsManagerBase) InitDbService ¶
func (s *SmsManagerBase) InitDbService(ctx op_context.Context, poool pool.Pool, role string) error
func (*SmsManagerBase) Send ¶
func (s *SmsManagerBase) Send(ctx auth.UserContext, message string, recipient string) (string, error)
type SmsManagerBaseConfig ¶
type SmsMessage ¶
type SmsMessage struct { common.ObjectWithMonthBase auth.WithUserBase Context string `gorm:"index;index:,unique,composite:u_month"` ForeignId string `gorm:"index"` Phone string `gorm:"index"` Operation string `gorm:"index"` Provider string `gorm:"index"` Status string `gorm:"index"` Tenancy string `gorm:"index"` Message string RawResponse string }
Click to show internal directories.
Click to hide internal directories.