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 DeleteRuleTimersParams

type DeleteRuleTimersParams struct {
	OrgID int64
	Ids   []int64
}

type DeleteRulesParams

type DeleteRulesParams struct {
	OrgID  int64
	UserID int64
}

type GetOrganizationRulesRow

type GetOrganizationRulesRow struct {
	NotificationRules []byte
	Version           int64
}

type GetRuleRunGroupParams

type GetRuleRunGroupParams struct {
	OrgID int64
	ID    int64
}

type GetRulesParams

type GetRulesParams struct {
	OrgID  int64
	UserID int64
}

type GetRulesRow

type GetRulesRow struct {
	State               string
	GatewayConnectionID pgtype.Int8
	Normal              []byte
	Important           []byte
	Version             int64
}

type GetRulesUserByIDParams

type GetRulesUserByIDParams struct {
	OrgID int64
	ID    int64
}

type GetRulesUserByIDRow

type GetRulesUserByIDRow struct {
	ID       int64
	PublicID string
	Name     string
	Status   string
}

type GetRulesUserParams

type GetRulesUserParams struct {
	OrgID    int64
	PublicID string
}

type GetRulesUserRow

type GetRulesUserRow struct {
	ID       int64
	PublicID string
	Name     string
	Status   string
}

type InsertRuleRunParams

type InsertRuleRunParams struct {
	OrgID           int64
	AlertGroupID    int64
	EscalationRunID int64
	StepNumber      int32
	UserID          int64
	Importance      string
	Actions         []byte
	Position        int32
	State           string
	Now             time.Time
	EndedAt         pgtype.Timestamptz
	RunStepSeq      pgtype.Int4
}

type ListRuleGatewaysParams

type ListRuleGatewaysParams struct {
	UserID int64
	OrgID  int64
}

type ListRuleGatewaysRow

type ListRuleGatewaysRow struct {
	ID       int64
	PublicID string
	Name     string
	Live     bool
	Contact  bool
}

type LockRuleRunParams

type LockRuleRunParams struct {
	OrgID int64
	ID    int64
}

type LockRuleRunRow

type LockRuleRunRow struct {
	ID              int64
	AlertGroupID    int64
	EscalationRunID int64
	StepNumber      int32
	UserID          int64
	Importance      string
	Actions         []byte
	Position        int32
	State           string
	RunState        string
	ChainID         int64
	ChainName       string
	Sources         []byte
	OwningTeamID    int64
	ChainPublicID   string
	ScheduleID      int64
	Deadline        time.Time
}

type LockRulesUserParams

type LockRulesUserParams struct {
	OrgID int64
	ID    int64
}

type LockRulesUserRow

type LockRulesUserRow struct {
	ID       int64
	PublicID string
	Name     string
	Status   string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteRuleTimers

func (q *Queries) DeleteRuleTimers(ctx context.Context, arg DeleteRuleTimersParams) error

DeleteRuleTimers deletes the timers of the rule runs.

func (*Queries) DeleteRules

func (q *Queries) DeleteRules(ctx context.Context, arg DeleteRulesParams) (int64, error)

DeleteRules deletes the rules of a User, who then follows the Organization's rules; and those of a deleted User.

func (*Queries) GetOrganizationRules

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

GetOrganizationRules reads the Organization's default rules (organization.notification_rules) with the version of the organization resource, from which the ETag of the state organization comes.

func (*Queries) GetRuleRunGroup

func (q *Queries) GetRuleRunGroup(ctx context.Context, arg GetRuleRunGroupParams) (int64, error)

GetRuleRunGroup reads the Alert Group of a rule run, which the action of its timer locks first.

func (*Queries) GetRules

func (q *Queries) GetRules(ctx context.Context, arg GetRulesParams) (GetRulesRow, error)

GetRules reads the rules of a User in the state call, no_call or custom; no row is the state organization.

func (*Queries) GetRulesUser

func (q *Queries) GetRulesUser(ctx context.Context, arg GetRulesUserParams) (GetRulesUserRow, error)

GetRulesUser reads a User an Admin names, deleted ones included.

func (*Queries) GetRulesUserByID

func (q *Queries) GetRulesUserByID(ctx context.Context, arg GetRulesUserByIDParams) (GetRulesUserByIDRow, error)

GetRulesUserByID reads the signed-in User.

func (*Queries) InsertRuleRun

func (q *Queries) InsertRuleRun(ctx context.Context, arg InsertRuleRunParams) (int64, error)

InsertRuleRun starts the run of a person's rule for a step that Paged them (C-31.FR-3), at its position and state after the actions it made at once, with the seq of the run step that started it, which its later Mentions belong to (C-32.FR-12).

func (*Queries) ListRuleGateways

func (q *Queries) ListRuleGateways(ctx context.Context, arg ListRuleGatewaysParams) ([]ListRuleGatewaysRow, error)

ListRuleGateways lists every Bridge Connection, deleted ones included, which a call action may name: whether it is a Notification gateway now — not deleted, its info declaring the role gateway — and whether the User user_id has a confirmed contact there.

func (*Queries) LockRuleRun

func (q *Queries) LockRuleRun(ctx context.Context, arg LockRuleRunParams) (LockRuleRunRow, error)

LockRuleRun locks a rule run for its next action, after its Alert Group, with the deadline of its timer — the zero time 0001-01-01 once it was removed — and the run of its chain: its state, its chain, its sources, the owning Team it had when it started and the Schedule of the step that Paged the person, 0 once that Schedule was deleted: the run's steps are a snapshot, which a deleted Schedule outlives.

func (*Queries) LockRulesUser

func (q *Queries) LockRulesUser(ctx context.Context, arg LockRulesUserParams) (LockRulesUserRow, error)

SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors Notification rules (C-31): the rules of the Users in the states call, no_call and custom, the Organization's default rules that the Users in the state organization follow, and the Notification gateways a call names. LockRulesUser locks the User whose rules change, so that the rules of one User change one at a time and never after the User's deletion, which locks the row first.

func (*Queries) NotifyRuleTimers

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

NotifyRuleTimers wakes the timer workers of every replica once the transaction commits.

func (*Queries) SaveRuleRun

func (q *Queries) SaveRuleRun(ctx context.Context, arg SaveRuleRunParams) error

SaveRuleRun writes where a rule run is after its actions.

func (*Queries) StopRuleRuns

func (q *Queries) StopRuleRuns(ctx context.Context, arg StopRuleRunsParams) ([]int64, error)

StopRuleRuns stops the rule runs that still run on an Alert Group whose chains stopped or started over (C-31.FR-3): those of runs that ran out included, whose rule may still repeat.

func (*Queries) UpsertRuleTimer

func (q *Queries) UpsertRuleTimer(ctx context.Context, arg UpsertRuleTimerParams) error

UpsertRuleTimer sets the timer of a rule run at the end of its wait, a new lease to claim. The subject is the rule run: the Alert Group, the Storm and the run of the chain are null, and the conflict is on timers_notification_rule_run_key, never timers_alert_group_key (schema.md §4.10).

func (*Queries) UpsertRules

func (q *Queries) UpsertRules(ctx context.Context, arg UpsertRulesParams) (int64, error)

UpsertRules writes the rules of a User with a new version from the sequence.

func (*Queries) WithTx

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

type SaveRuleRunParams

type SaveRuleRunParams struct {
	Position int32
	State    string
	EndedAt  pgtype.Timestamptz
	OrgID    int64
	ID       int64
}

type StopRuleRunsParams

type StopRuleRunsParams struct {
	Now          time.Time
	OrgID        int64
	AlertGroupID int64
}

type UpsertRuleTimerParams

type UpsertRuleTimerParams struct {
	OrgID                 int64
	NotificationRuleRunID int64
	Deadline              time.Time
	Now                   time.Time
}

type UpsertRulesParams

type UpsertRulesParams struct {
	OrgID               int64
	UserID              int64
	State               string
	GatewayConnectionID pgtype.Int8
	Normal              []byte
	Important           []byte
	Now                 time.Time
}

Jump to

Keyboard shortcuts

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