messages

package
v1.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorTTLExpired = "TTL expired"
)

Variables

View Source
var Module = fx.Module(
	"messages",
	fx.Decorate(func(log *zap.Logger) *zap.Logger {
		return log.Named("messages")
	}),
	fx.Provide(NewService),
	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 *repositories.MessagesRepository
	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 HashingTaskConfig struct {
	Interval time.Duration
}

type HashingTaskParams

type HashingTaskParams struct {
	fx.In

	Messages *repositories.MessagesRepository
	Config   HashingTaskConfig
	Logger   *zap.Logger
}

type Service

type Service struct {
	Messages    *repositories.MessagesRepository
	HashingTask *HashingTask

	PushSvc *push.Service
	Logger  *zap.Logger
	// 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 (s *Service) RunBackgroundTasks(ctx context.Context, wg *sync.WaitGroup)

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

type ServiceParams

type ServiceParams struct {
	fx.In

	Messages    *repositories.MessagesRepository
	HashingTask *HashingTask

	PushSvc *push.Service
	Logger  *zap.Logger
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL