dbgen

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 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 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 DeleteLinkRuleMatchersParams

type DeleteLinkRuleMatchersParams struct {
	OrgID      int64
	LinkRuleID int64
}

type DeleteLinkRuleParams

type DeleteLinkRuleParams struct {
	OrgID int64
	ID    int64
}

type DeleteLookupEntriesParams

type DeleteLookupEntriesParams struct {
	OrgID         int64
	LookupTableID int64
}

type DeleteLookupTableParams

type DeleteLookupTableParams struct {
	OrgID int64
	ID    int64
}

type EnsureExploreRuleParams

type EnsureExploreRuleParams struct {
	OrgID             int64
	PublicID          string
	Name              string
	UrlTemplate       string
	Now               time.Time
	PreviousTemplates []string
}

type EnsureExploreRuleRow

type EnsureExploreRuleRow struct {
	PublicID string
	Updated  bool
}

type GetLinkGroupParams

type GetLinkGroupParams struct {
	OrgID int64
	ID    int64
}

type GetLinkGroupRow

type GetLinkGroupRow struct {
	ID                int64
	PublicID          string
	Number            int64
	Title             string
	Summary           pgtype.Text
	Status            string
	SeverityLevel     string
	Urgent            bool
	GroupKeyValues    []byte
	CommonLabels      []byte
	CommonAnnotations []byte
	ReopenCount       int64
	CreatedAt         time.Time
	RoutePublicID     string
	RouteName         string
	TimeZone          string
	OwnerName         string
}

type GetLinkRuleParams

type GetLinkRuleParams struct {
	OrgID    int64
	PublicID string
}

type GetLinkRuleRow

type GetLinkRuleRow struct {
	ID          int64
	PublicID    string
	Name        string
	Builtin     bool
	ScopeType   string
	ScopeLabel  pgtype.Text
	UrlTemplate string
	CreatedAt   time.Time
	Version     int64
	ManagedBy   pgtype.Text
}

type GetLookupCellsParams

type GetLookupCellsParams struct {
	OrgID int64
	Name  string
	Key   string
}

type GetLookupTableParams

type GetLookupTableParams struct {
	OrgID    int64
	PublicID string
}

type GetLookupTableRow

type GetLookupTableRow struct {
	ID          int64
	PublicID    string
	Name        string
	Description string
	ColumnNames []string
	CreatedAt   time.Time
	Version     int64
	ManagedBy   pgtype.Text
}

type InsertLinkRuleMatcherParams

type InsertLinkRuleMatcherParams struct {
	LinkRuleID int64
	OrgID      int64
	Position   int64
	Label      string
	Op         string
	Value      string
}

type InsertLinkRuleParams

type InsertLinkRuleParams struct {
	OrgID       int64
	PublicID    string
	Name        string
	ScopeType   string
	ScopeLabel  pgtype.Text
	UrlTemplate string
	ManagedBy   pgtype.Text
	Now         time.Time
}

type InsertLinksUpdateParams

type InsertLinksUpdateParams struct {
	OrgID       int64
	RequestedAt time.Time
}

type InsertLookupEntriesParams

type InsertLookupEntriesParams struct {
	LookupTableID int64
	Keys          []string
	OrgID         int64
	Cells         [][]byte
}

type InsertLookupTableParams

type InsertLookupTableParams struct {
	OrgID       int64
	PublicID    string
	Name        string
	Description string
	ColumnNames []string
	ManagedBy   pgtype.Text
	Now         time.Time
}

type ListLinkAlertsParams

type ListLinkAlertsParams struct {
	OrgID        int64
	AlertGroupID int64
	Lim          int32
}

type ListLinkAlertsRow

type ListLinkAlertsRow struct {
	Fingerprint  string
	Labels       []byte
	Annotations  []byte
	StartsAt     time.Time
	EndedAt      pgtype.Timestamptz
	GeneratorUrl pgtype.Text
	State        string
}

type ListLinkRuleMatchersParams

type ListLinkRuleMatchersParams struct {
	OrgID       int64
	LinkRuleIds []int64
}

type ListLinkRuleMatchersRow

type ListLinkRuleMatchersRow struct {
	LinkRuleID int64
	Label      string
	Op         string
	Value      string
}

type ListLinkRuleTemplatesRow

type ListLinkRuleTemplatesRow struct {
	PublicID    string
	Name        string
	UrlTemplate string
}

type ListLinkRulesParams

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

type ListLinkRulesRow

type ListLinkRulesRow struct {
	ID          int64
	PublicID    string
	Name        string
	Builtin     bool
	ScopeType   string
	ScopeLabel  pgtype.Text
	UrlTemplate string
	CreatedAt   time.Time
	Version     int64
	ManagedBy   pgtype.Text
}

type ListLookupEntriesParams

type ListLookupEntriesParams struct {
	OrgID          int64
	LookupTableIds []int64
}

type ListLookupEntriesRow

type ListLookupEntriesRow struct {
	LookupTableID int64
	Key           string
	Cells         []byte
}

type ListLookupTablesParams

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

type ListLookupTablesRow

type ListLookupTablesRow struct {
	ID          int64
	PublicID    string
	Name        string
	Description string
	ColumnNames []string
	CreatedAt   time.Time
	Version     int64
	ManagedBy   pgtype.Text
}

type ListRecentSnapshotsParams

type ListRecentSnapshotsParams struct {
	OrgID     int64
	NotBefore time.Time
	Lim       int32
}

type LockLinkRuleParams

type LockLinkRuleParams struct {
	OrgID    int64
	PublicID string
}

type LockLinkRulesParams

type LockLinkRulesParams struct {
	LockClass int32
	OrgID     int64
}

type LockLookupTableParams

type LockLookupTableParams struct {
	OrgID    int64
	PublicID string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteLinkRule

func (q *Queries) DeleteLinkRule(ctx context.Context, arg DeleteLinkRuleParams) error

DeleteLinkRule deletes a Link rule that is not the built-in one, with its Matchers.

func (*Queries) DeleteLinkRuleMatchers

func (q *Queries) DeleteLinkRuleMatchers(ctx context.Context, arg DeleteLinkRuleMatchersParams) error

DeleteLinkRuleMatchers deletes the Matchers of a Link rule, which an update writes again.

func (*Queries) DeleteLookupEntries

func (q *Queries) DeleteLookupEntries(ctx context.Context, arg DeleteLookupEntriesParams) error

DeleteLookupEntries deletes every row of a Lookup table, which the rows of an update replace.

func (*Queries) DeleteLookupTable

func (q *Queries) DeleteLookupTable(ctx context.Context, arg DeleteLookupTableParams) error

DeleteLookupTable deletes a Lookup table with its rows.

func (*Queries) EnsureExploreRule

func (q *Queries) EnsureExploreRule(ctx context.Context, arg EnsureExploreRuleParams) (EnsureExploreRuleRow, error)

EnsureExploreRule creates the built-in "Explore" rule of the Organization unless it has one, and gives an existing one the URL template while it still has one of the previous built-in templates; it returns no row when the rule exists and keeps its template, and updated true when it gave an existing rule the new template (xmax is set only on the row an ON CONFLICT update wrote).

func (*Queries) GetLinkGroup

func (q *Queries) GetLinkGroup(ctx context.Context, arg GetLinkGroupParams) (GetLinkGroupRow, error)

GetLinkGroup reads what the links of an Alert Group are computed from: the Alert Group, its Route, the Organization's time zone and its Owner's name.

func (*Queries) GetLinkRule

func (q *Queries) GetLinkRule(ctx context.Context, arg GetLinkRuleParams) (GetLinkRuleRow, error)

GetLinkRule reads a Link rule by public_id.

func (*Queries) GetLinkSnapshotRetention

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

GetLinkSnapshotRetention reads retention.stored_snapshots in days.

func (*Queries) GetLookupCells

func (q *Queries) GetLookupCells(ctx context.Context, arg GetLookupCellsParams) ([]byte, error)

GetLookupCells reads the cells of one row of the Lookup table named name, for `lookup`.

func (*Queries) GetLookupTable

func (q *Queries) GetLookupTable(ctx context.Context, arg GetLookupTableParams) (GetLookupTableRow, error)

GetLookupTable reads a Lookup table by public_id.

func (*Queries) InsertLinkRule

func (q *Queries) InsertLinkRule(ctx context.Context, arg InsertLinkRuleParams) (int64, error)

InsertLinkRule creates a Link rule; the unique name is checked by its constraint.

func (*Queries) InsertLinkRuleMatcher

func (q *Queries) InsertLinkRuleMatcher(ctx context.Context, arg InsertLinkRuleMatcherParams) error

InsertLinkRuleMatcher writes one Matcher of a Link rule at its position.

func (*Queries) InsertLinksUpdate

func (q *Queries) InsertLinksUpdate(ctx context.Context, arg InsertLinksUpdateParams) error

InsertLinksUpdate requests that a change of a Link rule or of a Lookup table reach the open Root messages, whose links it may change (C-12.FR-9), with a row organization_links without a scope; the open_group_updates worker of any replica claims it and re-renders every open Alert Group of the Organization. A row organization_links that no worker has claimed yet already covers the change, since its run computes the links with the rules and tables as they are then: it is locked, so that no worker claims it before this transaction commits, and no second one is inserted.

func (*Queries) InsertLookupEntries

func (q *Queries) InsertLookupEntries(ctx context.Context, arg InsertLookupEntriesParams) error

InsertLookupEntries writes rows of a Lookup table: keys[i] with cells[i].

func (*Queries) InsertLookupTable

func (q *Queries) InsertLookupTable(ctx context.Context, arg InsertLookupTableParams) (int64, error)

InsertLookupTable creates a Lookup table; the unique name is checked by its constraint.

func (*Queries) ListLinkAlerts

func (q *Queries) ListLinkAlerts(ctx context.Context, arg ListLinkAlertsParams) ([]ListLinkAlertsRow, error)

ListLinkAlerts lists the Alerts of an Alert Group that its messages show, firing first and newest first, at most lim of them.

func (*Queries) ListLinkRuleMatchers

func (q *Queries) ListLinkRuleMatchers(ctx context.Context, arg ListLinkRuleMatchersParams) ([]ListLinkRuleMatchersRow, error)

ListLinkRuleMatchers lists the Matchers of the Link rules, in their order.

func (*Queries) ListLinkRuleTemplates

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

ListLinkRuleTemplates lists the names and URL templates of every Link rule, for the use of a Lookup table.

func (*Queries) ListLinkRules

func (q *Queries) ListLinkRules(ctx context.Context, arg ListLinkRulesParams) ([]ListLinkRulesRow, error)

ListLinkRules lists a page of the Link rules in the order they were created, after the id after_id.

func (*Queries) ListLookupEntries

func (q *Queries) ListLookupEntries(ctx context.Context, arg ListLookupEntriesParams) ([]ListLookupEntriesRow, error)

ListLookupEntries lists the rows of the Lookup tables, by key.

func (*Queries) ListLookupTables

func (q *Queries) ListLookupTables(ctx context.Context, arg ListLookupTablesParams) ([]ListLookupTablesRow, error)

SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors Links (C-12.FR-9): Lookup tables with their rows, Link rules with their Matchers, the cells `lookup` reads, the samples of a Link rule's dry run, and the Alert Group whose links getAlertGroup computes on read. ListLookupTables lists a page of the Lookup tables in the order they were created, after the id after_id.

func (*Queries) ListRecentSnapshots

func (q *Queries) ListRecentSnapshots(ctx context.Context, arg ListRecentSnapshotsParams) ([][]byte, error)

ListRecentSnapshots lists the bodies of the most recent processed Alertmanager Stored Snapshots of the Organization within the retention of Stored Snapshots, newest first, for the dry run of a Link rule.

func (*Queries) LockLinkRule

func (q *Queries) LockLinkRule(ctx context.Context, arg LockLinkRuleParams) (int64, error)

LockLinkRule locks a Link rule by public_id for a change.

func (*Queries) LockLinkRules

func (q *Queries) LockLinkRules(ctx context.Context, arg LockLinkRulesParams) error

LockLinkRules takes the transaction advisory lock of the changes of the Link rules and Lookup tables of the Organization (db.LinkRulesLockClass, keyed by the Organization) exclusively, until the end of the transaction.

func (*Queries) LockLookupTable

func (q *Queries) LockLookupTable(ctx context.Context, arg LockLookupTableParams) (int64, error)

LockLookupTable locks a Lookup table by public_id for a change.

func (*Queries) NotifyOpenGroupUpdates

func (q *Queries) NotifyOpenGroupUpdates(ctx context.Context, channel string) error

NotifyOpenGroupUpdates wakes the open Alert Group update workers of every replica once the transaction commits.

func (*Queries) UpdateLinkRule

func (q *Queries) UpdateLinkRule(ctx context.Context, arg UpdateLinkRuleParams) error

UpdateLinkRule replaces the fields of a Link rule and bumps its version.

func (*Queries) UpdateLookupTable

func (q *Queries) UpdateLookupTable(ctx context.Context, arg UpdateLookupTableParams) error

UpdateLookupTable replaces the fields of a Lookup table and bumps its version.

func (*Queries) WithTx

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

type UpdateLinkRuleParams

type UpdateLinkRuleParams struct {
	Name        string
	ScopeType   string
	ScopeLabel  pgtype.Text
	UrlTemplate string
	ManagedBy   pgtype.Text
	Now         time.Time
	OrgID       int64
	ID          int64
}

type UpdateLookupTableParams

type UpdateLookupTableParams struct {
	Name        string
	Description string
	ColumnNames []string
	ManagedBy   pgtype.Text
	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