common

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DlqSuffix = "-dlq"

	// envs:
	LocalEnv = "local"
	ProEnv   = "pro"

	// message statuses:
	ReadyStatus      = 0
	ProcessingStatus = 1
	FailedStatus     = 2

	// OS:
	WindowsOS = "windows"
	LinuxOS   = "linux"
	MacOS     = "darwin"

	// reasons to move message to DLQ:
	MaxAttemptsReachedFailureReason = "max_attempts_reached"
	MessageExpiredFailureReason     = "message_expired"
)
View Source
const (
	ErrCodeBadRequestContentExceedsLimit = "bad_request.body.content.exceeds_limit"
	ErrCodeBadRequestProcessAfterInPast  = "bad_request.body.processAfter.in_past"
	ErrCodeBadRequestProcessAfterTooFar  = "bad_request.body.processAfter.too_far"
	ErrCodeBadRequestInvalidBody         = "bad_request.body.invalid"
	ErrCodeBadRequestDlqOnlyOp           = "bad_request.dlq_only_operation"
	ErrCodeUnauthorized                  = "unauthorized"
	ErrCodeTooManyRequests               = "too_many_requests"
	ErrCodeNotFoundMessage               = "not_found.message"
	ErrCodeServiceUnhealthy              = "forq.unhealthy"
	ErrCodeInternal                      = "internal"
)

Variables

View Source
var (
	ErrBadRequestContentExceedsLimit = ForqError{Code: ErrCodeBadRequestContentExceedsLimit}
	ErrBadRequestProcessAfterInPast  = ForqError{Code: ErrCodeBadRequestProcessAfterInPast}
	ErrBadRequestProcessAfterTooFar  = ForqError{Code: ErrCodeBadRequestProcessAfterTooFar}
	ErrBadRequestDlqOnlyOp           = ForqError{Code: ErrCodeBadRequestDlqOnlyOp}
	ErrNotFoundMessage               = ForqError{Code: ErrCodeNotFoundMessage}
	ErrInternal                      = ForqError{Code: ErrCodeInternal}
)
View Source
var (
	SupportedEnvs = map[string]bool{
		LocalEnv: true,
		ProEnv:   true,
	}
)

Functions

This section is empty.

Types

type DashboardPageData

type DashboardPageData struct {
	Title         string
	TotalQueues   int
	TotalMessages int
	DLQMessages   int
	Queues        []QueueStats
}

DashboardPageData contains data for the dashboard page

type ErrorResponse

type ErrorResponse struct {
	Code string `json:"code,omitempty"`
}

type ForqError

type ForqError struct {
	Code string
}

func (ForqError) Error

func (fe ForqError) Error() string

type LoginPageData

type LoginPageData struct {
	Title string
	Error string
}

LoginPageData contains data for the login page

type MessageDetails

type MessageDetails struct {
	ID                  string
	Content             string
	Status              string
	Attempts            int
	ReceivedAt          string
	Age                 string
	ProcessAfter        string
	ProcessingStartedAt string
	FailureReason       string
	UpdatedAt           string
}

MessageDetails represents detailed information about a message for UI display (full expansion)

type MessageMetadata

type MessageMetadata struct {
	ID           string
	Status       string
	Attempts     int
	Age          string
	ProcessAfter string
}

MessageMetadata represents basic metadata about a message with the idea of saving memory and network by not including full content

type MessageResponse

type MessageResponse struct {
	Id      string `json:"id"`
	Content string `json:"content"`
}

type MessagesComponentData

type MessagesComponentData struct {
	Messages   []MessageMetadata
	NextCursor string // Last message ID for cursor-based pagination
	HasMore    bool   // Whether there are more messages to load
	QueueName  string // For HTMX URLs
	IsDLQ      bool   // Whether this is a DLQ queue (for action buttons)
}

MessagesComponentData contains data for the messages component with cursor-based pagination

type NewMessageRequest

type NewMessageRequest struct {
	Content      string `json:"content"`
	ProcessAfter int64  `json:"processAfter,omitempty"` // optional Unix timestamp in milliseconds
}

type QueuePageData

type QueuePageData struct {
	Title string
	Queue *QueueStats
}

QueuePageData contains data for individual queue pages (queue stats only, no messages)

type QueueStats

type QueueStats struct {
	Name          string
	TotalMessages int
	Type          string // "Regular" or "DLQ"
}

QueueStats represents queue statistics for dashboard display

Jump to

Keyboard shortcuts

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