db

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDeliveryParams

type CreateDeliveryParams struct {
	EndpointID pgtype.UUID `json:"endpoint_id"`
	Event      string      `json:"event"`
	Body       []byte      `json:"body"`
}

type CreateWebhookEndpointParams

type CreateWebhookEndpointParams struct {
	Name   string   `json:"name"`
	Url    string   `json:"url"`
	Secret []byte   `json:"secret"`
	Events []string `json:"events"`
}

type CreateWebhookEndpointRow

type CreateWebhookEndpointRow struct {
	ID        pgtype.UUID        `json:"id"`
	Name      string             `json:"name"`
	Url       string             `json:"url"`
	Events    []string           `json:"events"`
	Enabled   bool               `json:"enabled"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type FailDeliveryParams

type FailDeliveryParams struct {
	Failure pgtype.Text `json:"failure"`
	ID      pgtype.UUID `json:"id"`
}

type GetDeliveryStatusParams

type GetDeliveryStatusParams struct {
	ID         pgtype.UUID `json:"id"`
	EndpointID pgtype.UUID `json:"endpoint_id"`
}

type GetWebhookEndpointRow

type GetWebhookEndpointRow struct {
	Url    string `json:"url"`
	Secret []byte `json:"secret"`
}

type ListDeliveriesPageParams

type ListDeliveriesPageParams struct {
	EndpointID pgtype.UUID        `json:"endpoint_id"`
	AfterAt    pgtype.Timestamptz `json:"after_at"`
	AfterID    pgtype.UUID        `json:"after_id"`
	Lim        int32              `json:"lim"`
}

type ListDeliveriesPageRow

type ListDeliveriesPageRow struct {
	ID            pgtype.UUID        `json:"id"`
	Event         string             `json:"event"`
	Status        string             `json:"status"`
	StatusCode    pgtype.Int4        `json:"status_code"`
	Attempts      int32              `json:"attempts"`
	Failure       string             `json:"failure"`
	CreatedAt     pgtype.Timestamptz `json:"created_at"`
	AttemptedAt   pgtype.Timestamptz `json:"attempted_at"`
	NextAttemptAt pgtype.Timestamptz `json:"next_attempt_at"`
}

type ListWebhookEndpointsParams

type ListWebhookEndpointsParams struct {
	Pattern string             `json:"pattern"`
	AfterAt pgtype.Timestamptz `json:"after_at"`
	AfterID pgtype.UUID        `json:"after_id"`
	Lim     int32              `json:"lim"`
}

type ListWebhookEndpointsRow

type ListWebhookEndpointsRow struct {
	ID        pgtype.UUID        `json:"id"`
	Name      string             `json:"name"`
	Url       string             `json:"url"`
	Events    []string           `json:"events"`
	Enabled   bool               `json:"enabled"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CountDeliveries

func (q *Queries) CountDeliveries(ctx context.Context, endpointID pgtype.UUID) (int64, error)

func (*Queries) CountWebhookEndpoints

func (q *Queries) CountWebhookEndpoints(ctx context.Context, pattern string) (int64, error)

func (*Queries) CreateDelivery

func (q *Queries) CreateDelivery(ctx context.Context, arg CreateDeliveryParams) (pgtype.UUID, error)

func (*Queries) CreateWebhookEndpoint

func (q *Queries) CreateWebhookEndpoint(ctx context.Context, arg CreateWebhookEndpointParams) (CreateWebhookEndpointRow, error)

func (*Queries) DeleteWebhookEndpoint

func (q *Queries) DeleteWebhookEndpoint(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) EndpointExists

func (q *Queries) EndpointExists(ctx context.Context, id pgtype.UUID) (bool, error)

func (*Queries) FailDelivery

func (q *Queries) FailDelivery(ctx context.Context, arg FailDeliveryParams) error

A job that stopped for good, or was never sent.

func (*Queries) GetDeliveryStatus

func (q *Queries) GetDeliveryStatus(ctx context.Context, arg GetDeliveryStatusParams) (string, error)

func (*Queries) GetWebhookEndpoint

func (q *Queries) GetWebhookEndpoint(ctx context.Context, id pgtype.UUID) (GetWebhookEndpointRow, error)

func (*Queries) ListDeliveriesPage

func (q *Queries) ListDeliveriesPage(ctx context.Context, arg ListDeliveriesPageParams) ([]ListDeliveriesPageRow, error)

func (*Queries) ListWebhookEndpoints

func (q *Queries) ListWebhookEndpoints(ctx context.Context, arg ListWebhookEndpointsParams) ([]ListWebhookEndpointsRow, error)

func (*Queries) RecordDelivery

func (q *Queries) RecordDelivery(ctx context.Context, arg RecordDeliveryParams) error

The attempt's outcome. The count rises on each try, also after a manual retry.

func (*Queries) RequeueDelivery

func (q *Queries) RequeueDelivery(ctx context.Context, arg RequeueDeliveryParams) (RequeueDeliveryRow, error)

Puts a failed delivery back in the queue; no row when it wasn't failed.

func (*Queries) RetentionWebhooks

func (q *Queries) RetentionWebhooks(ctx context.Context) (int64, error)

func (*Queries) ShowWebhookEndpoint

func (q *Queries) ShowWebhookEndpoint(ctx context.Context, id pgtype.UUID) (ShowWebhookEndpointRow, error)

func (*Queries) UpdateWebhookEndpoint

func (q *Queries) UpdateWebhookEndpoint(ctx context.Context, arg UpdateWebhookEndpointParams) (UpdateWebhookEndpointRow, error)

Changes only what's given.

func (*Queries) WebhookEndpointIDs

func (q *Queries) WebhookEndpointIDs(ctx context.Context, event string) ([]pgtype.UUID, error)

The endpoints an event goes to: switched on, and wanting every event or this one.

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type RecordDeliveryParams

type RecordDeliveryParams struct {
	Status        string             `json:"status"`
	StatusCode    pgtype.Int4        `json:"status_code"`
	Failure       pgtype.Text        `json:"failure"`
	NextAttemptAt pgtype.Timestamptz `json:"next_attempt_at"`
	ID            pgtype.UUID        `json:"id"`
}

type RequeueDeliveryParams

type RequeueDeliveryParams struct {
	ID         pgtype.UUID `json:"id"`
	EndpointID pgtype.UUID `json:"endpoint_id"`
}

type RequeueDeliveryRow

type RequeueDeliveryRow struct {
	ID   pgtype.UUID `json:"id"`
	Body []byte      `json:"body"`
}

type ShowWebhookEndpointRow

type ShowWebhookEndpointRow struct {
	ID        pgtype.UUID        `json:"id"`
	Name      string             `json:"name"`
	Url       string             `json:"url"`
	Events    []string           `json:"events"`
	Enabled   bool               `json:"enabled"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type UpdateWebhookEndpointParams

type UpdateWebhookEndpointParams struct {
	Name    pgtype.Text `json:"name"`
	Url     pgtype.Text `json:"url"`
	Events  []string    `json:"events"`
	Enabled pgtype.Bool `json:"enabled"`
	ID      pgtype.UUID `json:"id"`
}

type UpdateWebhookEndpointRow

type UpdateWebhookEndpointRow struct {
	ID        pgtype.UUID        `json:"id"`
	Name      string             `json:"name"`
	Url       string             `json:"url"`
	Events    []string           `json:"events"`
	Enabled   bool               `json:"enabled"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

Jump to

Keyboard shortcuts

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