dbgen

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountNewerOfConnectionParams

type CountNewerOfConnectionParams struct {
	OrgID        int64
	ConnectionID int64
	At           time.Time
	ID           int64
	MaxRecords   int32
}

type CountNewerOfDestinationParams

type CountNewerOfDestinationParams struct {
	OrgID         int64
	DestinationID int64
	At            time.Time
	ID            int64
	MaxRecords    int32
}

type CountNewerUnownedParams

type CountNewerUnownedParams struct {
	OrgID      int64
	At         time.Time
	ID         int64
	MaxRecords int32
}

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 FindConnectionParams

type FindConnectionParams struct {
	OrgID    int64
	PublicID string
}

type FindDestinationParams

type FindDestinationParams struct {
	OrgID    int64
	PublicID string
}

type FindDestinationRow

type FindDestinationRow struct {
	ID           int64
	Type         string
	ConnectionID pgtype.Int8
}

type GetRecordParams

type GetRecordParams struct {
	OrgID     int64
	PublicID  string
	NotBefore time.Time
}

type GetRecordRow

type GetRecordRow struct {
	ID                      int64
	PublicID                string
	At                      time.Time
	Direction               string
	Operation               string
	CheckKind               pgtype.Text
	CheckRun                pgtype.Text
	Method                  string
	Url                     string
	RequestHeaders          []byte
	RequestBody             string
	RequestBodyBytes        int64
	RequestBodyTruncated    bool
	Status                  pgtype.Int4
	ResponseHeaders         []byte
	ResponseBody            pgtype.Text
	ResponseBodyBytes       int64
	ResponseBodyTruncated   bool
	LatencyMs               int32
	Via                     string
	Attempt                 int32
	ErrorClass              pgtype.Text
	ErrorCode               pgtype.Text
	Error                   pgtype.Text
	ConnectionID            pgtype.Int8
	DestinationID           pgtype.Int8
	ConnectionPublicID      pgtype.Text
	ConnectionDeletedAt     pgtype.Timestamptz
	DestinationPublicID     pgtype.Text
	DestinationName         pgtype.Text
	DestinationType         pgtype.Text
	DestinationHealth       pgtype.Text
	DestinationBrokenSince  pgtype.Timestamptz
	DestinationBrokenReason pgtype.Text
	DestinationDeletedAt    pgtype.Timestamptz
	AlertGroupPublicID      pgtype.Text
	AlertGroupNumber        pgtype.Int8
}

type InsertRecordParams

type InsertRecordParams struct {
	OrgID                 int64
	PublicID              string
	At                    time.Time
	Direction             string
	Operation             string
	Method                string
	Url                   string
	RequestHeaders        []byte
	RequestBody           string
	RequestBodyBytes      int64
	RequestBodyTruncated  bool
	Status                pgtype.Int4
	ResponseHeaders       []byte
	ResponseBody          pgtype.Text
	ResponseBodyBytes     int64
	ResponseBodyTruncated bool
	LatencyMs             int32
	Via                   string
	Attempt               int32
	ErrorClass            pgtype.Text
	ErrorCode             pgtype.Text
	Error                 pgtype.Text
	ConnectionID          pgtype.Int8
	DestinationID         pgtype.Int8
	AlertGroupID          pgtype.Int8
	CheckKind             pgtype.Text
	CheckRun              pgtype.Text
}

type ListConnectionRecordsParams

type ListConnectionRecordsParams struct {
	OrgID         int64
	DestinationID pgtype.Int8
	Direction     pgtype.Text
	NoAnswer      bool
	StatusFrom    pgtype.Int4
	StatusTo      pgtype.Int4
	Operation     pgtype.Text
	AlertGroup    pgtype.Text
	CheckRun      pgtype.Text
	AfterAt       pgtype.Timestamptz
	AfterID       pgtype.Int8
	PageSize      int32
	ConnectionID  int64
	NotBefore     time.Time
	MaxRecords    int32
}

type ListConnectionRecordsRow

type ListConnectionRecordsRow struct {
	ID                      int64
	PublicID                string
	At                      time.Time
	Direction               string
	Operation               string
	CheckKind               pgtype.Text
	CheckRun                pgtype.Text
	Method                  string
	Url                     string
	Status                  pgtype.Int4
	LatencyMs               int32
	Via                     string
	Attempt                 int32
	ErrorClass              pgtype.Text
	ErrorCode               pgtype.Text
	RequestBodyTruncated    bool
	ResponseBodyTruncated   bool
	ConnectionPublicID      pgtype.Text
	DestinationPublicID     pgtype.Text
	DestinationName         pgtype.Text
	DestinationType         pgtype.Text
	DestinationHealth       pgtype.Text
	DestinationBrokenSince  pgtype.Timestamptz
	DestinationBrokenReason pgtype.Text
	AlertGroupPublicID      pgtype.Text
	AlertGroupNumber        pgtype.Int8
}

type ListDestinationRecordsParams

type ListDestinationRecordsParams struct {
	OrgID         int64
	Direction     pgtype.Text
	NoAnswer      bool
	StatusFrom    pgtype.Int4
	StatusTo      pgtype.Int4
	Operation     pgtype.Text
	AlertGroup    pgtype.Text
	CheckRun      pgtype.Text
	AfterAt       pgtype.Timestamptz
	AfterID       pgtype.Int8
	PageSize      int32
	DestinationID int64
	NotBefore     time.Time
	MaxRecords    int32
}

type ListDestinationRecordsRow

type ListDestinationRecordsRow struct {
	ID                      int64
	PublicID                string
	At                      time.Time
	Direction               string
	Operation               string
	CheckKind               pgtype.Text
	CheckRun                pgtype.Text
	Method                  string
	Url                     string
	Status                  pgtype.Int4
	LatencyMs               int32
	Via                     string
	Attempt                 int32
	ErrorClass              pgtype.Text
	ErrorCode               pgtype.Text
	RequestBodyTruncated    bool
	ResponseBodyTruncated   bool
	ConnectionPublicID      pgtype.Text
	DestinationPublicID     pgtype.Text
	DestinationName         pgtype.Text
	DestinationType         pgtype.Text
	DestinationHealth       pgtype.Text
	DestinationBrokenSince  pgtype.Timestamptz
	DestinationBrokenReason pgtype.Text
	AlertGroupPublicID      pgtype.Text
	AlertGroupNumber        pgtype.Int8
}

type ListRunRecordsParams

type ListRunRecordsParams struct {
	OrgID      int64
	CheckRun   string
	NotBefore  time.Time
	Direction  pgtype.Text
	NoAnswer   bool
	StatusFrom pgtype.Int4
	StatusTo   pgtype.Int4
	Operation  pgtype.Text
	AlertGroup pgtype.Text
	AfterAt    pgtype.Timestamptz
	AfterID    pgtype.Int8
	MaxRecords int32
	PageSize   int32
}

type ListRunRecordsRow

type ListRunRecordsRow struct {
	ID                      int64
	PublicID                string
	At                      time.Time
	Direction               string
	Operation               string
	CheckKind               pgtype.Text
	CheckRun                pgtype.Text
	Method                  string
	Url                     string
	Status                  pgtype.Int4
	LatencyMs               int32
	Via                     string
	Attempt                 int32
	ErrorClass              pgtype.Text
	ErrorCode               pgtype.Text
	RequestBodyTruncated    bool
	ResponseBodyTruncated   bool
	ConnectionPublicID      pgtype.Text
	DestinationPublicID     pgtype.Text
	DestinationName         pgtype.Text
	DestinationType         pgtype.Text
	DestinationHealth       pgtype.Text
	DestinationBrokenSince  pgtype.Timestamptz
	DestinationBrokenReason pgtype.Text
	AlertGroupPublicID      pgtype.Text
	AlertGroupNumber        pgtype.Int8
}

type PruneConnectionExcessParams

type PruneConnectionExcessParams struct {
	OrgID        int64
	ConnectionID int64
	MaxRecords   int32
	BatchSize    int32
}

type PruneDestinationExcessParams

type PruneDestinationExcessParams struct {
	OrgID         int64
	DestinationID int64
	MaxRecords    int32
	BatchSize     int32
}

type PruneOlderParams

type PruneOlderParams struct {
	OrgID     int64
	Before    time.Time
	BatchSize int32
}

type PruneUnownedExcessParams

type PruneUnownedExcessParams struct {
	OrgID      int64
	MaxRecords int32
	BatchSize  int32
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountNewerOfConnection

func (q *Queries) CountNewerOfConnection(ctx context.Context, arg CountNewerOfConnectionParams) (int64, error)

CountNewerOfConnection counts, up to @max_records, the records of the Connection newer than (@at, @id): a record with @max_records newer ones is past the count bound.

func (*Queries) CountNewerOfDestination

func (q *Queries) CountNewerOfDestination(ctx context.Context, arg CountNewerOfDestinationParams) (int64, error)

CountNewerOfDestination counts the newer records of an outgoing webhook Destination as CountNewerOfConnection does.

func (*Queries) CountNewerUnowned

func (q *Queries) CountNewerUnowned(ctx context.Context, arg CountNewerUnownedParams) (int64, error)

CountNewerUnowned counts the newer records without an owner as CountNewerOfConnection does.

func (*Queries) FindConnection

func (q *Queries) FindConnection(ctx context.Context, arg FindConnectionParams) (int64, error)

FindConnection reads the id of a Connection that is not deleted.

func (*Queries) FindDestination

func (q *Queries) FindDestination(ctx context.Context, arg FindDestinationParams) (FindDestinationRow, error)

FindDestination reads a Destination that is not deleted: its id, its type and its Connection, null for an outgoing webhook.

func (*Queries) GetRecord

func (q *Queries) GetRecord(ctx context.Context, arg GetRecordParams) (GetRecordRow, error)

GetRecord reads a record that is not older than @not_before, with what its owner's bound and Permission need: the deletion of its Connection and of its Destination.

func (*Queries) InsertRecord

func (q *Queries) InsertRecord(ctx context.Context, arg InsertRecordParams) error

SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors The Request log (C-23): one row per request, masked before it is written. A record's owner is its Connection, else its outgoing webhook Destination, else nobody (the checks before saving of new Connections); reads show only the records newer than request_log.max_age among the newest request_log.max_records of their owner, and the pruning deletes the rest.

func (*Queries) ListConnectionIDs

func (q *Queries) ListConnectionIDs(ctx context.Context, orgID int64) ([]int64, error)

ListConnectionIDs lists every Connection of the Organization, deleted ones included: each owns its records.

func (*Queries) ListConnectionRecords

func (q *Queries) ListConnectionRecords(ctx context.Context, arg ListConnectionRecordsParams) ([]ListConnectionRecordsRow, error)

ListConnectionRecords lists, newest first, the records among the newest @max_records of the Connection that are not older than @not_before, after the cursor and filtered — by @destination_id for the view of a messenger Destination, and by a check run. The bounded set is chosen once, in a materialized CTE, so the filters scan at most @max_records rows.

func (*Queries) ListDestinationRecords

func (q *Queries) ListDestinationRecords(ctx context.Context, arg ListDestinationRecordsParams) ([]ListDestinationRecordsRow, error)

ListDestinationRecords lists the records of an outgoing webhook Destination as ListConnectionRecords lists those of a Connection, filtered by a check run too.

func (*Queries) ListRunRecords

func (q *Queries) ListRunRecords(ctx context.Context, arg ListRunRecordsParams) ([]ListRunRecordsRow, error)

ListRunRecords lists, newest first, the records of the check run @check_run that connections:read reads — those of a Connection that is not deleted and those without an owner — that are not older than @not_before and are among the newest @max_records of their owner, after the cursor and filtered. A run has a handful of records, found through the age bound and the run; each is held to its owner's count bound by counting at most @max_records newer records of that owner, as getRequestRecord does. The records of an outgoing webhook's runs are listed by its Destination.

func (*Queries) ListWebhookDestinationIDs

func (q *Queries) ListWebhookDestinationIDs(ctx context.Context, orgID int64) ([]int64, error)

ListWebhookDestinationIDs lists every outgoing webhook Destination of the Organization, deleted ones included.

func (*Queries) PruneConnectionExcess

func (q *Queries) PruneConnectionExcess(ctx context.Context, arg PruneConnectionExcessParams) (int64, error)

PruneConnectionExcess deletes up to @batch_size records of the Connection older than the oldest of its newest @max_records (edge), which a run never touches; with fewer records the edge is the oldest one and nothing goes. Both choices are made once, in materialized CTEs, as in PruneOlder.

func (*Queries) PruneDestinationExcess

func (q *Queries) PruneDestinationExcess(ctx context.Context, arg PruneDestinationExcessParams) (int64, error)

PruneDestinationExcess deletes the records of an outgoing webhook Destination past the count bound as PruneConnectionExcess does.

func (*Queries) PruneOlder

func (q *Queries) PruneOlder(ctx context.Context, arg PruneOlderParams) (int64, error)

PruneOlder deletes up to @batch_size records older than @before. The batch is chosen once, in a materialized CTE: a subquery that a plan scans again for each deleted row skips the rows the statement already deleted, as locked by itself, and takes more than the batch.

func (*Queries) PruneUnownedExcess

func (q *Queries) PruneUnownedExcess(ctx context.Context, arg PruneUnownedExcessParams) (int64, error)

PruneUnownedExcess deletes the records without an owner past the count bound as PruneConnectionExcess does.

func (*Queries) WithTx

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

Jump to

Keyboard shortcuts

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