Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultPageSize is the default number of messages returned per page when not specified DefaultPageSize = 20 // MaxPageSize is the maximum number of messages that can be returned per page // This prevents excessive memory usage and ensures reasonable response times MaxPageSize = 100 // MinPageSize is the minimum page size allowed (must be at least 1) MinPageSize = 1 // MinPage is the minimum page number (pages start from 1) MinPage = 1 )
Pagination constants
View Source
const MAXIMUM_MESSAGE_SENDING_TIME = 5 * time.Second
Variables ¶
View Source
var ( ErrInvalidPageSize = errors.New("page size cannot be negative") ErrPageSizeTooLarge = fmt.Errorf("page size cannot exceed %d", MaxPageSize) ErrPageSizeTooSmall = fmt.Errorf("page size must be at least %d", MinPageSize) ErrMessageNotFound = errors.New("message not found") ErrInvalidMessageID = errors.New("invalid message ID format") )
Pagination errors
Functions ¶
This section is empty.
Types ¶
type MessageInterface ¶
type MessageInterface interface {
GetSentMessages(ctx context.Context, page, pageSize int) (*dto.MessagesListResponse, error)
GetMessageByID(ctx context.Context, id string) (*dto.SingleMessageResponse, error)
}
MessageInterface defines message-related operations
type MessageService ¶
type MessageService struct {
// contains filtered or unexported fields
}
func NewMessageService ¶
func NewMessageService(database *bun.DB) *MessageService
func (*MessageService) GetMessageByID ¶
func (s *MessageService) GetMessageByID(ctx context.Context, id string) (*dto.SingleMessageResponse, error)
GetMessageByID retrieves a single message by its ID
func (*MessageService) GetSentMessages ¶
func (s *MessageService) GetSentMessages(ctx context.Context, page, pageSize int) (*dto.MessagesListResponse, error)
GetSentMessages retrieves paginated sent messages Parameters: - page: Page number (starts from 1, defaults to 1 if < 1) - pageSize: Number of messages per page (0 = default, must be between 1-100) Returns error if pageSize is invalid (negative or > 100)
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler handles the automatic message sending functionality
func (*Scheduler) GetStatus ¶
func (s *Scheduler) GetStatus() *dto.MessagingStatusResponse
GetStatus returns the current status of the messaging service
type SchedulerInterface ¶
type SchedulerInterface interface {
Start(ctx context.Context) (*dto.MessagingControlResponse, error)
Stop(ctx context.Context) (*dto.MessagingControlResponse, error)
GetStatus() *dto.MessagingStatusResponse
IsRunning() bool
}
SchedulerInterface defines messaging scheduler control operations
Click to show internal directories.
Click to hide internal directories.