dbgen

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 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 CountTruncatedGroupsOfParams

type CountTruncatedGroupsOfParams struct {
	OrgID          int64
	IntegrationIds []int64
}

type CountTruncatedGroupsOfRow

type CountTruncatedGroupsOfRow struct {
	IntegrationID       int64
	TruncatedGroupCount int64
}

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 DeleteIntegrationParams

type DeleteIntegrationParams struct {
	Now   time.Time
	OrgID int64
	ID    int64
}

type EnsureBuiltinParams

type EnsureBuiltinParams struct {
	OrgID                   int64
	PublicID                string
	Name                    string
	Description             string
	DuplicateWindowSeconds  int64
	HeartbeatTimeoutSeconds int64
	Now                     time.Time
}

type EnsureIntegrationTokenParams

type EnsureIntegrationTokenParams struct {
	OrgID         int64
	PublicID      string
	IntegrationID int64
	Name          pgtype.Text
	TokenHash     []byte
	Now           time.Time
}

type FindIngestTokenParams

type FindIngestTokenParams struct {
	OrgID     int64
	TokenHash []byte
}

type FindIngestTokenRow

type FindIngestTokenRow struct {
	ID                   int64
	TokenHash            []byte
	RevokedAt            pgtype.Timestamptz
	LastUsedAt           pgtype.Timestamptz
	IntegrationID        int64
	IntegrationPublicID  string
	IntegrationDeletedAt pgtype.Timestamptz
}

type FindIntegrationByNameParams

type FindIntegrationByNameParams struct {
	OrgID int64
	Name  string
}

type GetIntegrationParams

type GetIntegrationParams struct {
	OrgID    int64
	PublicID string
}

type GetIntegrationRow

type GetIntegrationRow struct {
	ID                      int64
	PublicID                string
	Name                    string
	Description             string
	Builtin                 bool
	ConnectionMode          string
	StaticLabels            []byte
	DuplicateWindowSeconds  int64
	HeartbeatEnabled        bool
	HeartbeatTimeoutSeconds int64
	HeartbeatState          string
	HeartbeatLastSignalAt   pgtype.Timestamptz
	HeartbeatLostSince      pgtype.Timestamptz
	SnapshotCount           int64
	CreatedAt               time.Time
	Version                 int64
}

type InsertIntegrationParams

type InsertIntegrationParams struct {
	OrgID                   int64
	PublicID                string
	Name                    string
	Description             string
	ConnectionMode          string
	StaticLabels            []byte
	DuplicateWindowSeconds  int64
	HeartbeatEnabled        bool
	HeartbeatTimeoutSeconds int64
	Now                     time.Time
}

type InsertIntegrationTokenParams

type InsertIntegrationTokenParams struct {
	OrgID         int64
	PublicID      string
	IntegrationID int64
	Name          pgtype.Text
	TokenHash     []byte
	Now           time.Time
}

type LastSnapshotTimesParams

type LastSnapshotTimesParams struct {
	IntegrationIds []int64
	OrgID          int64
}

type LastSnapshotTimesRow

type LastSnapshotTimesRow struct {
	IntegrationID int64
	ReceivedAt    time.Time
}

type ListIntegrationInfoRow

type ListIntegrationInfoRow struct {
	PublicID string
	Name     string
	Builtin  bool
}

type ListIntegrationTokensParams

type ListIntegrationTokensParams struct {
	OrgID         int64
	IntegrationID int64
}

type ListIntegrationTokensRow

type ListIntegrationTokensRow struct {
	ID         int64
	PublicID   string
	Name       pgtype.Text
	CreatedAt  time.Time
	LastUsedAt pgtype.Timestamptz
}

type ListIntegrationsParams

type ListIntegrationsParams struct {
	OrgID    int64
	AfterID  pgtype.Int8
	PageSize int32
}

type ListIntegrationsRow

type ListIntegrationsRow struct {
	ID                      int64
	PublicID                string
	Name                    string
	Description             string
	Builtin                 bool
	ConnectionMode          string
	StaticLabels            []byte
	DuplicateWindowSeconds  int64
	HeartbeatEnabled        bool
	HeartbeatTimeoutSeconds int64
	HeartbeatState          string
	HeartbeatLastSignalAt   pgtype.Timestamptz
	HeartbeatLostSince      pgtype.Timestamptz
	SnapshotCount           int64
	CreatedAt               time.Time
	Version                 int64
}

type ListLongRepeatRoutesParams

type ListLongRepeatRoutesParams struct {
	OrgID          int64
	IntegrationIds []int64
	ThresholdMs    int64
}

type ListLongRepeatRoutesRow

type ListLongRepeatRoutesRow struct {
	IntegrationID           int64
	RoutePath               string
	LearnedRepeatIntervalMs int64
}

type LockIntegrationParams

type LockIntegrationParams struct {
	OrgID    int64
	PublicID string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountTruncatedGroupsOf

func (q *Queries) CountTruncatedGroupsOf(ctx context.Context, arg CountTruncatedGroupsOfParams) ([]CountTruncatedGroupsOfRow, error)

CountTruncatedGroupsOf counts the truncated groupKeys of each of the Integrations that has one (the warning snapshot_truncated).

func (*Queries) DeleteIntegration

func (q *Queries) DeleteIntegration(ctx context.Context, arg DeleteIntegrationParams) error

DeleteIntegration marks an Integration deleted; its row, its tokens and its Stored Snapshots stay.

func (*Queries) EnsureBuiltin

func (q *Queries) EnsureBuiltin(ctx context.Context, arg EnsureBuiltinParams) (string, error)

EnsureBuiltin creates the built-in "Muster" Integration of the Organization once: webhook-only, without Static labels and with the Heartbeat off. It returns no row when it exists.

func (*Queries) EnsureIntegrationToken

func (q *Queries) EnsureIntegrationToken(ctx context.Context, arg EnsureIntegrationTokenParams) (string, error)

EnsureIntegrationToken stores a token of the development demo, or gives the stored one back to the Integration and takes back its revocation; it returns the token's public_id when it wrote a row, and no row otherwise.

func (*Queries) FindIngestToken

func (q *Queries) FindIngestToken(ctx context.Context, arg FindIngestTokenParams) (FindIngestTokenRow, error)

FindIngestToken finds an Integration token by the SHA-256 of its value, with what ingestion decides on: whether the token is revoked, and the Integration with its deletion.

func (*Queries) FindIntegrationByName

func (q *Queries) FindIntegrationByName(ctx context.Context, arg FindIntegrationByNameParams) (string, error)

FindIntegrationByName returns the public_id of the Integration that is not deleted and has the name.

func (*Queries) GetIntegration

func (q *Queries) GetIntegration(ctx context.Context, arg GetIntegrationParams) (GetIntegrationRow, error)

GetIntegration reads an Integration that is not deleted.

func (*Queries) InsertIntegration

func (q *Queries) InsertIntegration(ctx context.Context, arg InsertIntegrationParams) (int64, error)

InsertIntegration creates an Integration; a Heartbeat that is on waits for its first signal.

func (*Queries) InsertIntegrationToken

func (q *Queries) InsertIntegrationToken(ctx context.Context, arg InsertIntegrationTokenParams) (int64, error)

InsertIntegrationToken stores an Integration token by the SHA-256 of its value.

func (*Queries) LastSnapshotTimes

func (q *Queries) LastSnapshotTimes(ctx context.Context, arg LastSnapshotTimesParams) ([]LastSnapshotTimesRow, error)

LastSnapshotTimes returns the time of the newest Stored Snapshot of each of the Integrations that has one, each read through the list index of its Integration.

func (*Queries) ListIntegrationInfo

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

ListIntegrationInfo lists the id, the name and whether it is built in of every Integration that is not deleted, for muster_integration_info and the series of muster_ingest_requests_total.

func (*Queries) ListIntegrationTokens

func (q *Queries) ListIntegrationTokens(ctx context.Context, arg ListIntegrationTokensParams) ([]ListIntegrationTokensRow, error)

ListIntegrationTokens lists the tokens of an Integration that are not revoked, the newest first.

func (*Queries) ListIntegrations

func (q *Queries) ListIntegrations(ctx context.Context, arg ListIntegrationsParams) ([]ListIntegrationsRow, error)

SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors ListIntegrations lists the Integrations that are not deleted, in the order they were created, after the cursor when one is given.

func (*Queries) ListLongRepeatRoutes

func (q *Queries) ListLongRepeatRoutes(ctx context.Context, arg ListLongRepeatRoutesParams) ([]ListLongRepeatRoutesRow, error)

ListLongRepeatRoutes lists the Alertmanager routes of the Integrations whose learned repeat interval is above @threshold_ms (the warning long_repeat_interval), in the order of their paths.

func (*Queries) LockDemo

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

LockDemo serializes the demo start-up step of replicas that start together, until the transaction ends.

func (*Queries) LockIntegration

func (q *Queries) LockIntegration(ctx context.Context, arg LockIntegrationParams) (int64, error)

LockIntegration locks an Integration that is not deleted for a change and returns its id.

func (*Queries) RevokeIntegrationToken

func (q *Queries) RevokeIntegrationToken(ctx context.Context, arg RevokeIntegrationTokenParams) (RevokeIntegrationTokenRow, error)

RevokeIntegrationToken revokes a token of an Integration that is not revoked yet and returns its name.

func (*Queries) TouchIntegrationToken

func (q *Queries) TouchIntegrationToken(ctx context.Context, arg TouchIntegrationTokenParams) error

TouchIntegrationToken records the use of a token, at most once a minute: a row used since @stale_before is left alone.

func (*Queries) UpdateIntegration

func (q *Queries) UpdateIntegration(ctx context.Context, arg UpdateIntegrationParams) error

UpdateIntegration replaces the configured fields. The Heartbeat state follows its setting (C-07.FR-3): turned on from not_configured it waits for the first signal, turned off it is not_configured and no longer lost; otherwise the runtime state (Heartbeat state, liveness clock, counters) is left alone.

func (*Queries) WithTx

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

type RevokeIntegrationTokenParams

type RevokeIntegrationTokenParams struct {
	Now           time.Time
	OrgID         int64
	IntegrationID int64
	PublicID      string
}

type RevokeIntegrationTokenRow

type RevokeIntegrationTokenRow struct {
	ID   int64
	Name pgtype.Text
}

type TouchIntegrationTokenParams

type TouchIntegrationTokenParams struct {
	Now         time.Time
	OrgID       int64
	ID          int64
	StaleBefore time.Time
}

type UpdateIntegrationParams

type UpdateIntegrationParams struct {
	Name                    string
	Description             string
	StaticLabels            []byte
	DuplicateWindowSeconds  int64
	HeartbeatEnabled        bool
	HeartbeatTimeoutSeconds int64
	Now                     time.Time
	OrgID                   int64
	ID                      int64
}

Jump to

Keyboard shortcuts

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