Files
member-console/internal/integration/outbox.sql.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

50 lines
1.8 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: outbox.sql
package integration
import (
"context"
)
const countOutboxByStatus = `-- name: CountOutboxByStatus :one
SELECT
COUNT(*) FILTER (WHERE status = 'pending') AS pending_count,
COUNT(*) FILTER (WHERE status = 'failed') AS failed_count,
COUNT(*) FILTER (WHERE status = 'dead_letter') AS dead_letter_count
FROM core.outbox
`
type CountOutboxByStatusRow struct {
PendingCount int64 `json:"pending_count"`
FailedCount int64 `json:"failed_count"`
DeadLetterCount int64 `json:"dead_letter_count"`
}
// Operator overview "System" panel: the health of the integration delivery
// queue in one round trip.
//
// The three buckets mean different things to an operator and are therefore
// reported separately rather than summed:
//
// pending — enqueued, not yet attempted or waiting on next_attempt_at.
// A steady non-zero value is normal.
// failed — attempted and errored, still inside max_attempts, so the
// poller will retry. In-flight, not lost.
// dead_letter — exhausted its retries. Nothing will move this without an
// operator, so it is the only bucket that warrants an alarm.
//
// Enqueue-side writes go through integration.Enqueue (internal/integration/
// outbox.go); this is a read-only health probe over the same table.
func (q *Queries) CountOutboxByStatus(ctx context.Context) (CountOutboxByStatusRow, error) {
row := q.db.QueryRowContext(ctx, countOutboxByStatus)
var i CountOutboxByStatusRow
err := row.Scan(&i.PendingCount, &i.FailedCount, &i.DeadLetterCount)
return i, err
}