Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type EnqueueOptions
- type ErrValidation
- type FxResult
- type HashingTask
- type HashingTaskConfig
- type HashingTaskParams
- type MessagesSelectFilter
- type MessagesSelectOptions
- type Service
- func (s *Service) Clean(ctx context.Context) error
- func (s *Service) Enqeue(device models.Device, message smsgateway.Message, opts EnqueueOptions) (smsgateway.MessageState, error)
- func (s *Service) GetState(user models.User, ID string) (smsgateway.MessageState, error)
- func (s *Service) RunBackgroundTasks(ctx context.Context, wg *sync.WaitGroup)
- func (s *Service) SelectPending(deviceID string) ([]smsgateway.Message, error)
- func (s *Service) UpdateState(deviceID string, message smsgateway.MessageState) error
- type ServiceParams
Constants ¶
View Source
const (
ErrorTTLExpired = "TTL expired"
)
Variables ¶
View Source
var ErrMessageAlreadyExists = errors.New("duplicate id")
View Source
var ErrMessageNotFound = gorm.ErrRecordNotFound
View Source
var Module = fx.Module( "messages", fx.Decorate(func(log *zap.Logger) *zap.Logger { return log.Named("messages") }), fx.Provide(func(p ServiceParams) FxResult { svc := NewService(p) return FxResult{ Service: svc, AsCleaner: svc, } }), fx.Provide(newRepository), fx.Provide(NewHashingTask, fx.Private), )
Functions ¶
This section is empty.
Types ¶
type EnqueueOptions ¶
type EnqueueOptions struct {
SkipPhoneValidation bool
}
type ErrValidation ¶
type ErrValidation string
func (ErrValidation) Error ¶
func (e ErrValidation) Error() string
type HashingTask ¶
type HashingTask struct { Messages *repository Config HashingTaskConfig Logger *zap.Logger // contains filtered or unexported fields }
func NewHashingTask ¶
func NewHashingTask(params HashingTaskParams) *HashingTask
func (*HashingTask) Enqeue ¶
func (t *HashingTask) Enqeue(id uint64)
func (*HashingTask) Run ¶
func (t *HashingTask) Run(ctx context.Context)
type HashingTaskConfig ¶
type HashingTaskParams ¶
type HashingTaskParams struct { fx.In Messages *repository Config HashingTaskConfig Logger *zap.Logger }
type MessagesSelectFilter ¶
type MessagesSelectFilter struct {
DeviceID string
}
type MessagesSelectOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(params ServiceParams) *Service
func (*Service) Enqeue ¶
func (s *Service) Enqeue(device models.Device, message smsgateway.Message, opts EnqueueOptions) (smsgateway.MessageState, error)
func (*Service) GetState ¶
func (s *Service) GetState(user models.User, ID string) (smsgateway.MessageState, error)
func (*Service) RunBackgroundTasks ¶
func (*Service) SelectPending ¶
func (s *Service) SelectPending(deviceID string) ([]smsgateway.Message, error)
func (*Service) UpdateState ¶
func (s *Service) UpdateState(deviceID string, message smsgateway.MessageState) error
Click to show internal directories.
Click to hide internal directories.