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 CountGroupsParams

type CountGroupsParams struct {
	WithLabels      bool
	OrgID           int64
	Number          pgtype.Int8
	RangeTo         time.Time
	RangeFrom       time.Time
	RouteIds        []int64
	IntegrationIds  []int64
	Severities      []string
	Urgent          pgtype.Bool
	ResolvedBy      pgtype.Text
	ResolveReason   pgtype.Text
	Reopened        pgtype.Bool
	OwnerSet        bool
	OwnerID         pgtype.Int8
	SnoozedNoEnd    pgtype.Bool
	DeliveryProblem pgtype.Bool
	Unclaimed       pgtype.Bool
	Contains        []byte
	Pattern         pgtype.Text
}

type CountGroupsRow

type CountGroupsRow struct {
	Status       string
	CommonLabels []byte
	Count        int64
}

type CountOpenGroupsByIntegrationParams

type CountOpenGroupsByIntegrationParams struct {
	OrgID     int64
	PublicIds []string
}

type CountOpenGroupsByIntegrationRow

type CountOpenGroupsByIntegrationRow struct {
	PublicID string
	Count    int64
}

type CountOpenGroupsByRouteRow

type CountOpenGroupsByRouteRow struct {
	PublicID string
	Status   string
	Count    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 DeleteExpiredGroupsParams

type DeleteExpiredGroupsParams struct {
	OrgID     int64
	Cutoff    time.Time
	BatchSize int32
}

type DeleteExpiredMembershipsParams

type DeleteExpiredMembershipsParams struct {
	OrgID     int64
	Cutoff    time.Time
	BatchSize int32
}

type DeleteTimerParams

type DeleteTimerParams struct {
	OrgID        int64
	AlertGroupID int64
	Kind         string
}

type FindOpenGroupParams

type FindOpenGroupParams struct {
	OrgID          int64
	RouteID        int64
	GroupKeySha256 []byte
}

type FindReopenableGroupParams

type FindReopenableGroupParams struct {
	OrgID          int64
	RouteID        int64
	GroupKeySha256 []byte
	Now            time.Time
}

type GetGroupIDParams

type GetGroupIDParams struct {
	OrgID    int64
	PublicID string
}

type GetGroupIDRow

type GetGroupIDRow struct {
	ID                        int64
	ResolvedAt                pgtype.Timestamptz
	RetentionAlertDetailsDays int64
}

type GetGroupKeyParams

type GetGroupKeyParams struct {
	OrgID    int64
	PublicID string
}

type GetGroupKeyRow

type GetGroupKeyRow struct {
	ID             int64
	RouteID        int64
	GroupKeySha256 []byte
}

type GetGroupParams

type GetGroupParams struct {
	OrgID    int64
	PublicID string
}

type GetGroupRefParams

type GetGroupRefParams struct {
	OrgID int64
	ID    int64
}

type GetGroupRefRow

type GetGroupRefRow struct {
	PublicID string
	Number   int64
}

type GetGroupRow

type GetGroupRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Title                      string
	Summary                    pgtype.Text
	Status                     string
	SeverityLevel              string
	Urgent                     bool
	GroupKeyValues             []byte
	CommonLabels               []byte
	CommonAnnotations          []byte
	IntegrationIds             []int64
	ReopenCount                int64
	FiringAlertCount           int64
	ResolvedAlertCount         int64
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
	CreatedAt                  time.Time
	LastChangedAt              time.Time
	RoutePublicID              string
	RouteName                  string
	FiringAgainAfterNumber     int64
	ReplacedLabel              string
	StillFiring                int64
	RetentionAlertDetailsDays  int64
	OwnerUserID                pgtype.Int8
	SnoozeUntil                pgtype.Timestamptz
	SnoozedByUserID            pgtype.Int8
	SnoozedByServiceAccountID  pgtype.Int8
	NewerPublicID              string
	NewerNumber                int64
	RouteDeleted               bool
	DeliveryProblem            bool
	Unclaimed                  bool
	NextNoticeKind             string
	NextNoticeAt               time.Time
	ReminderPending            bool
}

type GetGroupTimerParams

type GetGroupTimerParams struct {
	OrgID        int64
	AlertGroupID int64
	Kind         string
}

type GetGroupingSettingsRow

type GetGroupingSettingsRow struct {
	CriticalIsUrgent bool
	InstanceLabels   []string
}

type GetLastReminderSeqParams

type GetLastReminderSeqParams struct {
	OrgID        int64
	AlertGroupID int64
}

type GetListSettingsRow

type GetListSettingsRow struct {
	RetentionAlertDetailsDays int64
	TimeZone                  string
	WorkdayStart              string
	WeekStart                 string
}

type GetRetentionPeriodsRow

type GetRetentionPeriodsRow struct {
	RetentionAlertDetailsDays        int64
	RetentionAlertGroupSummariesDays int64
}

type GetRoutePolicyParams

type GetRoutePolicyParams struct {
	OrgID int64
	ID    int64
}

type GetRoutePolicyRow

type GetRoutePolicyRow struct {
	ID                   int64
	PublicID             string
	IsDefault            bool
	Urgent               bool
	GroupKey             []string
	ReopenWindowSeconds  int64
	GracePeriodSeconds   int64
	UrgentRiseRemovesAck bool
}

type GetSnapshotReceivedAtParams

type GetSnapshotReceivedAtParams struct {
	OrgID int64
	ID    int64
}

type GetTimerPolicyParams

type GetTimerPolicyParams struct {
	OrgID int64
	ID    int64
}

type GetTimerPolicyRow

type GetTimerPolicyRow struct {
	AckTimeoutEnabled              bool
	AckTimeoutFirstIntervalSeconds int64
	RemindersEnabled               bool
	RemindersFirstIntervalSeconds  int64
	RemindersCapSeconds            int64
	AutoUnacknowledge              bool
}

type GetUserTimeZoneParams

type GetUserTimeZoneParams struct {
	OrgID int64
	ID    int64
}

type InsertDowntimeEntriesParams

type InsertDowntimeEntriesParams struct {
	OrgID         int64
	PublicIds     []string
	AlertGroupIds []int64
	At            time.Time
	PeriodFrom    time.Time
	PeriodTo      time.Time
}

type InsertGroupParams

type InsertGroupParams struct {
	OrgID              int64
	PublicID           string
	Number             int64
	RouteID            int64
	GroupKeyLabels     []string
	GroupKeyValues     []byte
	GroupKeySha256     []byte
	Title              string
	TitleFromGroupKey  bool
	Summary            pgtype.Text
	CommonLabels       []byte
	CommonAnnotations  []byte
	IntegrationIds     []int64
	SeverityLevel      string
	Urgent             bool
	FiringAgainAfterID pgtype.Int8
	CreatedAt          time.Time
}

type InsertMembershipsParams

type InsertMembershipsParams struct {
	OrgID         int64
	AlertGroupIds []int64
	AlertIds      []int64
	Episodes      []int64
	JoinedAt      time.Time
	StartsAts     []time.Time
	Annotations   [][]byte
}

type InsertNoteParams

type InsertNoteParams struct {
	OrgID                 int64
	PublicID              string
	AlertGroupID          int64
	EventSeq              int64
	Body                  string
	ActorKind             string
	ActorUserID           pgtype.Int8
	ActorServiceAccountID pgtype.Int8
	ApiTokenID            pgtype.Int8
	TokenName             pgtype.Text
	Transport             string
	CreatedAt             time.Time
}

type InsertTimelineEntryParams

type InsertTimelineEntryParams struct {
	OrgID                 int64
	PublicID              string
	AlertGroupID          int64
	At                    time.Time
	Kind                  string
	Event                 pgtype.Text
	EventSeq              pgtype.Int8
	SystemEvent           pgtype.Text
	Loudness              pgtype.Text
	Mentions              []string
	ActorKind             string
	ActorUserID           pgtype.Int8
	ActorServiceAccountID pgtype.Int8
	ApiTokenID            pgtype.Int8
	TokenName             pgtype.Text
	Transport             string
	Reason                pgtype.Text
	FromStatus            pgtype.Text
	ToStatus              pgtype.Text
	OwnerUserID           pgtype.Int8
	PreviousOwnerUserID   pgtype.Int8
	SnoozeUntil           pgtype.Timestamptz
	Fingerprints          []string
	ReplacedLabel         pgtype.Text
	LabelConflicts        []string
	PeriodFrom            pgtype.Timestamptz
	PeriodTo              pgtype.Timestamptz
	Detail                pgtype.Text
	NoticeNumber          pgtype.Int8
	MissedCount           pgtype.Int8
}

type IntegrationStatisticsParams

type IntegrationStatisticsParams struct {
	TimeZone       string
	OrgID          int64
	RangeFrom      time.Time
	RangeTo        time.Time
	IntegrationIds []int64
}

type IntegrationStatisticsRow

type IntegrationStatisticsRow struct {
	SubjectID       int64
	Day             pgtype.Date
	Total           bool
	AlertGroupCount int64
	ResolveCount    int64
	ResolveMedian   float64
	ResolveP95      float64
	AckCount        int64
	AckMedian       float64
	AckP95          float64
}

type IsActiveUserParams

type IsActiveUserParams struct {
	OrgID int64
	ID    int64
}

type ListAlertGroupKeysParams

type ListAlertGroupKeysParams struct {
	OrgID    int64
	AlertIds []int64
}

type ListAlertGroupKeysRow

type ListAlertGroupKeysRow struct {
	AlertID  int64
	GroupKey string
}

type ListChangedAlertsParams

type ListChangedAlertsParams struct {
	OrgID int64
	Ids   []int64
}

type ListChangedAlertsRow

type ListChangedAlertsRow struct {
	ID                   int64
	IntegrationID        int64
	Fingerprint          string
	Labels               []byte
	Annotations          []byte
	StaticLabelConflicts []string
	Status               string
	StartsAt             time.Time
	Episode              int64
	RouteID              pgtype.Int8
	SeverityLevel        pgtype.Text
}

type ListFiringMembershipsParams

type ListFiringMembershipsParams struct {
	OrgID    int64
	AlertIds []int64
}

type ListFiringMembershipsRow

type ListFiringMembershipsRow struct {
	ID           int64
	AlertGroupID int64
	AlertID      int64
	Episode      int64
	StartsAt     time.Time
	Annotations  []byte
}

type ListGroupAlertsParams

type ListGroupAlertsParams struct {
	OrgID        int64
	AlertGroupID int64
	AllStates    bool
	Firing       bool
	AfterRank    int32
	AfterID      int64
	Lim          int32
}

type ListGroupAlertsRow

type ListGroupAlertsRow struct {
	ID                  int64
	Ended               bool
	State               string
	StartsAt            time.Time
	Annotations         []byte
	EndedAt             pgtype.Timestamptz
	ResolveReason       pgtype.Text
	ResolveReasonText   pgtype.Text
	AlertID             int64
	Fingerprint         string
	Labels              []byte
	GeneratorUrl        pgtype.Text
	LastSeenAt          time.Time
	IntegrationPublicID string
	IntegrationName     string
}

type ListGroupFiringAlertsParams

type ListGroupFiringAlertsParams struct {
	OrgID         int64
	AlertGroupIds []int64
}

type ListGroupFiringAlertsRow

type ListGroupFiringAlertsRow struct {
	ID                   int64
	AlertGroupID         int64
	AlertID              int64
	Episode              int64
	StartsAt             time.Time
	Annotations          []byte
	IntegrationID        int64
	Fingerprint          string
	Labels               []byte
	StaticLabelConflicts []string
	SeverityLevel        pgtype.Text
	Status               string
}

type ListGroupsChangedAscParams

type ListGroupsChangedAscParams struct {
	OrgID           int64
	Statuses        []string
	Number          pgtype.Int8
	RangeTo         time.Time
	RangeFrom       time.Time
	RouteIds        []int64
	IntegrationIds  []int64
	Severities      []string
	Urgent          pgtype.Bool
	ResolvedBy      pgtype.Text
	ResolveReason   pgtype.Text
	Reopened        pgtype.Bool
	OwnerSet        bool
	OwnerID         pgtype.Int8
	SnoozedNoEnd    pgtype.Bool
	DeliveryProblem pgtype.Bool
	Unclaimed       pgtype.Bool
	Contains        []byte
	Pattern         pgtype.Text
	AfterAt         pgtype.Timestamptz
	AfterID         pgtype.Int8
	Lim             int32
}

type ListGroupsChangedAscRow

type ListGroupsChangedAscRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Title                      string
	Summary                    pgtype.Text
	Status                     string
	SeverityLevel              string
	Urgent                     bool
	CommonLabels               []byte
	IntegrationIds             []int64
	ReopenCount                int64
	FiringAlertCount           int64
	ResolvedAlertCount         int64
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
	CreatedAt                  time.Time
	LastChangedAt              time.Time
	RoutePublicID              string
	RouteName                  string
	OwnerUserID                pgtype.Int8
	SnoozeUntil                pgtype.Timestamptz
	SnoozedByUserID            pgtype.Int8
	SnoozedByServiceAccountID  pgtype.Int8
	NewerPublicID              string
	NewerNumber                int64
	RouteDeleted               bool
	DeliveryProblem            bool
	Unclaimed                  bool
	NextNoticeKind             string
	NextNoticeAt               time.Time
	ReminderPending            bool
}

type ListGroupsChangedDescParams

type ListGroupsChangedDescParams struct {
	OrgID           int64
	Statuses        []string
	Number          pgtype.Int8
	RangeTo         time.Time
	RangeFrom       time.Time
	RouteIds        []int64
	IntegrationIds  []int64
	Severities      []string
	Urgent          pgtype.Bool
	ResolvedBy      pgtype.Text
	ResolveReason   pgtype.Text
	Reopened        pgtype.Bool
	OwnerSet        bool
	OwnerID         pgtype.Int8
	SnoozedNoEnd    pgtype.Bool
	DeliveryProblem pgtype.Bool
	Unclaimed       pgtype.Bool
	Contains        []byte
	Pattern         pgtype.Text
	AfterAt         pgtype.Timestamptz
	AfterID         pgtype.Int8
	Lim             int32
}

type ListGroupsChangedDescRow

type ListGroupsChangedDescRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Title                      string
	Summary                    pgtype.Text
	Status                     string
	SeverityLevel              string
	Urgent                     bool
	CommonLabels               []byte
	IntegrationIds             []int64
	ReopenCount                int64
	FiringAlertCount           int64
	ResolvedAlertCount         int64
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
	CreatedAt                  time.Time
	LastChangedAt              time.Time
	RoutePublicID              string
	RouteName                  string
	OwnerUserID                pgtype.Int8
	SnoozeUntil                pgtype.Timestamptz
	SnoozedByUserID            pgtype.Int8
	SnoozedByServiceAccountID  pgtype.Int8
	NewerPublicID              string
	NewerNumber                int64
	RouteDeleted               bool
	DeliveryProblem            bool
	Unclaimed                  bool
	NextNoticeKind             string
	NextNoticeAt               time.Time
	ReminderPending            bool
}

type ListGroupsStartedAscParams

type ListGroupsStartedAscParams struct {
	OrgID           int64
	Statuses        []string
	Number          pgtype.Int8
	RangeTo         time.Time
	RangeFrom       time.Time
	RouteIds        []int64
	IntegrationIds  []int64
	Severities      []string
	Urgent          pgtype.Bool
	ResolvedBy      pgtype.Text
	ResolveReason   pgtype.Text
	Reopened        pgtype.Bool
	OwnerSet        bool
	OwnerID         pgtype.Int8
	SnoozedNoEnd    pgtype.Bool
	DeliveryProblem pgtype.Bool
	Unclaimed       pgtype.Bool
	Contains        []byte
	Pattern         pgtype.Text
	AfterAt         pgtype.Timestamptz
	AfterID         pgtype.Int8
	Lim             int32
}

type ListGroupsStartedAscRow

type ListGroupsStartedAscRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Title                      string
	Summary                    pgtype.Text
	Status                     string
	SeverityLevel              string
	Urgent                     bool
	CommonLabels               []byte
	IntegrationIds             []int64
	ReopenCount                int64
	FiringAlertCount           int64
	ResolvedAlertCount         int64
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
	CreatedAt                  time.Time
	LastChangedAt              time.Time
	RoutePublicID              string
	RouteName                  string
	OwnerUserID                pgtype.Int8
	SnoozeUntil                pgtype.Timestamptz
	SnoozedByUserID            pgtype.Int8
	SnoozedByServiceAccountID  pgtype.Int8
	NewerPublicID              string
	NewerNumber                int64
	RouteDeleted               bool
	DeliveryProblem            bool
	Unclaimed                  bool
	NextNoticeKind             string
	NextNoticeAt               time.Time
	ReminderPending            bool
}

type ListGroupsStartedDescParams

type ListGroupsStartedDescParams struct {
	OrgID           int64
	Statuses        []string
	Number          pgtype.Int8
	RangeTo         time.Time
	RangeFrom       time.Time
	RouteIds        []int64
	IntegrationIds  []int64
	Severities      []string
	Urgent          pgtype.Bool
	ResolvedBy      pgtype.Text
	ResolveReason   pgtype.Text
	Reopened        pgtype.Bool
	OwnerSet        bool
	OwnerID         pgtype.Int8
	SnoozedNoEnd    pgtype.Bool
	DeliveryProblem pgtype.Bool
	Unclaimed       pgtype.Bool
	Contains        []byte
	Pattern         pgtype.Text
	AfterAt         pgtype.Timestamptz
	AfterID         pgtype.Int8
	Lim             int32
}

type ListGroupsStartedDescRow

type ListGroupsStartedDescRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Title                      string
	Summary                    pgtype.Text
	Status                     string
	SeverityLevel              string
	Urgent                     bool
	CommonLabels               []byte
	IntegrationIds             []int64
	ReopenCount                int64
	FiringAlertCount           int64
	ResolvedAlertCount         int64
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
	CreatedAt                  time.Time
	LastChangedAt              time.Time
	RoutePublicID              string
	RouteName                  string
	OwnerUserID                pgtype.Int8
	SnoozeUntil                pgtype.Timestamptz
	SnoozedByUserID            pgtype.Int8
	SnoozedByServiceAccountID  pgtype.Int8
	NewerPublicID              string
	NewerNumber                int64
	RouteDeleted               bool
	DeliveryProblem            bool
	Unclaimed                  bool
	NextNoticeKind             string
	NextNoticeAt               time.Time
	ReminderPending            bool
}

type ListIntegrationRefsParams

type ListIntegrationRefsParams struct {
	OrgID int64
	Ids   []int64
}

type ListIntegrationRefsRow

type ListIntegrationRefsRow struct {
	ID       int64
	PublicID string
	Name     string
}

type ListIntegrationsByPublicIDParams

type ListIntegrationsByPublicIDParams struct {
	OrgID     int64
	PublicIds []string
}

type ListIntegrationsByPublicIDRow

type ListIntegrationsByPublicIDRow struct {
	ID       int64
	PublicID string
	Name     string
}

type ListJoinedDuringSnoozeParams

type ListJoinedDuringSnoozeParams struct {
	OrgID        int64
	AlertGroupID int64
}

type ListOpenGroupsOfRouteParams

type ListOpenGroupsOfRouteParams struct {
	OrgID   int64
	RouteID int64
}

type ListOwnedGroupsParams

type ListOwnedGroupsParams struct {
	OrgID  int64
	UserID int64
}

type ListRelatedGroupsParams

type ListRelatedGroupsParams struct {
	OrgID          int64
	RouteID        int64
	GroupKeySha256 []byte
	ID             int64
	AfterAt        pgtype.Timestamptz
	AfterID        pgtype.Int8
	Lim            int32
}

type ListRelatedGroupsRow

type ListRelatedGroupsRow struct {
	ID                         int64
	PublicID                   string
	Number                     int64
	Status                     string
	CreatedAt                  time.Time
	ResolvedAt                 pgtype.Timestamptz
	ResolvedByKind             pgtype.Text
	ResolvedByUserID           pgtype.Int8
	ResolvedByServiceAccountID pgtype.Int8
	ResolveReason              pgtype.Text
	ResolveReasonText          pgtype.Text
}

type ListRoutesByPublicIDParams

type ListRoutesByPublicIDParams struct {
	OrgID     int64
	PublicIds []string
}

type ListRoutesByPublicIDRow

type ListRoutesByPublicIDRow struct {
	ID       int64
	PublicID string
	Name     string
}

type ListServiceAccountRefsParams

type ListServiceAccountRefsParams struct {
	OrgID int64
	Ids   []int64
}

type ListServiceAccountRefsRow

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

type ListStatisticsIntegrationsParams

type ListStatisticsIntegrationsParams struct {
	OrgID   int64
	OnlyIds []int64
	WithIds []int64
}

type ListStatisticsIntegrationsRow

type ListStatisticsIntegrationsRow struct {
	ID       int64
	PublicID string
	Name     string
}

type ListStatisticsRoutesParams

type ListStatisticsRoutesParams struct {
	OrgID   int64
	OnlyIds []int64
	WithIds []int64
}

type ListStatisticsRoutesRow

type ListStatisticsRoutesRow struct {
	ID       int64
	PublicID string
	Name     string
}

type ListTimelineAscParams

type ListTimelineAscParams struct {
	OrgID        int64
	AlertGroupID int64
	Kinds        []string
	At           pgtype.Timestamptz
	Source       int32
	ID           int64
	Lim          int32
}

type ListTimelineAscRow

type ListTimelineAscRow struct {
	ID                    int64
	PublicID              string
	At                    time.Time
	Kind                  string
	Event                 pgtype.Text
	EventSeq              pgtype.Int8
	SystemEvent           pgtype.Text
	Loudness              pgtype.Text
	Mentions              []string
	ActorKind             string
	ActorUserID           pgtype.Int8
	ActorServiceAccountID pgtype.Int8
	TokenName             pgtype.Text
	Transport             string
	Reason                pgtype.Text
	FromStatus            pgtype.Text
	ToStatus              pgtype.Text
	OwnerUserID           pgtype.Int8
	PreviousOwnerUserID   pgtype.Int8
	SnoozeUntil           pgtype.Timestamptz
	Fingerprints          []string
	ReplacedLabel         pgtype.Text
	LabelConflicts        []string
	NoticeNumber          pgtype.Int8
	MissedCount           pgtype.Int8
	PeriodFrom            pgtype.Timestamptz
	PeriodTo              pgtype.Timestamptz
	Detail                pgtype.Text
}

type ListTimelineDeliveryEventsParams

type ListTimelineDeliveryEventsParams struct {
	OrgID        int64
	AlertGroupID int64
	At           pgtype.Timestamptz
	Descending   bool
	Source       int32
	ID           int64
	Lim          int32
}

type ListTimelineDeliveryEventsRow

type ListTimelineDeliveryEventsRow struct {
	ID                  int64
	PublicID            string
	OccurredAt          time.Time
	Kind                string
	Loudness            string
	Mentions            []string
	Error               pgtype.Text
	DestinationPublicID string
	DestinationName     string
}

type ListTimelineDescParams

type ListTimelineDescParams struct {
	OrgID        int64
	AlertGroupID int64
	Kinds        []string
	At           pgtype.Timestamptz
	Source       int32
	ID           int64
	Lim          int32
}

type ListTimelineDescRow

type ListTimelineDescRow struct {
	ID                    int64
	PublicID              string
	At                    time.Time
	Kind                  string
	Event                 pgtype.Text
	EventSeq              pgtype.Int8
	SystemEvent           pgtype.Text
	Loudness              pgtype.Text
	Mentions              []string
	ActorKind             string
	ActorUserID           pgtype.Int8
	ActorServiceAccountID pgtype.Int8
	TokenName             pgtype.Text
	Transport             string
	Reason                pgtype.Text
	FromStatus            pgtype.Text
	ToStatus              pgtype.Text
	OwnerUserID           pgtype.Int8
	PreviousOwnerUserID   pgtype.Int8
	SnoozeUntil           pgtype.Timestamptz
	Fingerprints          []string
	ReplacedLabel         pgtype.Text
	LabelConflicts        []string
	NoticeNumber          pgtype.Int8
	MissedCount           pgtype.Int8
	PeriodFrom            pgtype.Timestamptz
	PeriodTo              pgtype.Timestamptz
	Detail                pgtype.Text
}

type ListTimelineNotesParams

type ListTimelineNotesParams struct {
	OrgID        int64
	AlertGroupID int64
	At           pgtype.Timestamptz
	Descending   bool
	Source       int32
	ID           int64
	Lim          int32
}

type ListTimelineNotesRow

type ListTimelineNotesRow struct {
	ID                    int64
	PublicID              string
	CreatedAt             time.Time
	Body                  string
	ActorKind             string
	ActorUserID           pgtype.Int8
	ActorServiceAccountID pgtype.Int8
	TokenName             pgtype.Text
	Transport             string
}

type ListUserRefsParams

type ListUserRefsParams struct {
	OrgID int64
	Ids   []int64
}

type ListUserRefsRow

type ListUserRefsRow struct {
	ID       int64
	PublicID string
	Name     string
	Login    string
	Status   string
}

type ListUsersByPublicIDParams

type ListUsersByPublicIDParams struct {
	OrgID     int64
	PublicIds []string
}

type ListUsersByPublicIDRow

type ListUsersByPublicIDRow struct {
	ID       int64
	PublicID string
	Name     string
}

type LockActiveUserParams

type LockActiveUserParams struct {
	OrgID int64
	ID    int64
}

type LockDefaultRouteRow

type LockDefaultRouteRow struct {
	ID                   int64
	PublicID             string
	IsDefault            bool
	Urgent               bool
	GroupKey             []string
	ReopenWindowSeconds  int64
	GracePeriodSeconds   int64
	UrgentRiseRemovesAck bool
}

type LockGroupsParams

type LockGroupsParams struct {
	OrgID int64
	Ids   []int64
}

type LockGroupsRow

type LockGroupsRow struct {
	ID                             int64
	PublicID                       string
	Number                         int64
	RouteID                        int64
	MovedFromRouteID               pgtype.Int8
	GroupKeyLabels                 []string
	GroupKeyValues                 []byte
	GroupKeySha256                 []byte
	Title                          string
	TitleFromGroupKey              bool
	Summary                        pgtype.Text
	CommonLabels                   []byte
	CommonAnnotations              []byte
	IntegrationIds                 []int64
	Status                         string
	SeverityLevel                  string
	Urgent                         bool
	OwnerUserID                    pgtype.Int8
	AcknowledgedAt                 pgtype.Timestamptz
	SnoozeUntil                    pgtype.Timestamptz
	SnoozeNoEnd                    bool
	SnoozedWhileUrgent             bool
	SnoozedByUserID                pgtype.Int8
	SnoozedByServiceAccountID      pgtype.Int8
	FiringAlertCount               int64
	ResolvedAlertCount             int64
	ReopenCount                    int64
	ResolvedAt                     pgtype.Timestamptz
	ResolvedByKind                 pgtype.Text
	ResolvedByUserID               pgtype.Int8
	ResolvedByServiceAccountID     pgtype.Int8
	ResolveReason                  pgtype.Text
	ResolveReasonText              pgtype.Text
	ReopenDeadline                 pgtype.Timestamptz
	PriorStatus                    pgtype.Text
	PriorOwnerUserID               pgtype.Int8
	PriorSnoozeUntil               pgtype.Timestamptz
	PriorSnoozeNoEnd               pgtype.Bool
	PriorSnoozedWhileUrgent        pgtype.Bool
	PriorSnoozedByUserID           pgtype.Int8
	PriorSnoozedByServiceAccountID pgtype.Int8
	GraceDeadline                  pgtype.Timestamptz
	FiringAgainAfterID             pgtype.Int8
	EventSeq                       int64
	CreatedAt                      time.Time
	LastChangedAt                  time.Time
	FirstAcknowledgedAt            pgtype.Timestamptz
	FirstPublishedAt               pgtype.Timestamptz
	AckTimeoutStartedAt            pgtype.Timestamptz
	AckTimeoutNoticesSent          int64
	Unclaimed                      bool
	RemindersSent                  int64
	RemindersUnanswered            int64
	LastReminderAt                 pgtype.Timestamptz
	OwnerAnsweredAt                pgtype.Timestamptz
}

type LockRouteForMoveParams

type LockRouteForMoveParams struct {
	OrgID    int64
	PublicID string
}

type LockRouteForMoveRow

type LockRouteForMoveRow struct {
	ID        int64
	PublicID  string
	Name      string
	IsDefault bool
}

type LockRoutesParams

type LockRoutesParams struct {
	OrgID int64
	Ids   []int64
}

type LockRoutesRow

type LockRoutesRow struct {
	ID                   int64
	PublicID             string
	IsDefault            bool
	Urgent               bool
	GroupKey             []string
	ReopenWindowSeconds  int64
	GracePeriodSeconds   int64
	UrgentRiseRemovesAck bool
}

type MoveMembershipsParams

type MoveMembershipsParams struct {
	EndedAt  time.Time
	OrgID    int64
	Ids      []int64
	MovedTos []int64
}

type PeekGroupParams

type PeekGroupParams struct {
	OrgID int64
	ID    int64
}

type PeekGroupRow

type PeekGroupRow struct {
	RouteID       int64
	GraceDeadline pgtype.Timestamptz
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountGroups

func (q *Queries) CountGroups(ctx context.Context, arg CountGroupsParams) ([]CountGroupsRow, error)

CountGroups counts the Alert Groups of the list's filters per status, without the status and the cursor; with @with_labels it groups them by common_labels too, for the Matchers that Go applies.

func (*Queries) CountOpenGroupsByIntegration

func (q *Queries) CountOpenGroupsByIntegration(ctx context.Context, arg CountOpenGroupsByIntegrationParams) ([]CountOpenGroupsByIntegrationRow, error)

CountOpenGroupsByIntegration counts the open Alert Groups with an Alert from each of the Integrations (C-09.FR-21): those that deleting it would resolve.

func (*Queries) CountOpenGroupsByRoute

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

CountOpenGroupsByRoute counts the open Alert Groups per Route that is not deleted and status, for muster_alert_groups.

func (*Queries) DeleteExpiredGroups

func (q *Queries) DeleteExpiredGroups(ctx context.Context, arg DeleteExpiredGroupsParams) (int64, error)

DeleteExpiredGroups deletes at most @batch_size summary rows resolved before @cutoff. A summary row that an Alert inside another Alert Group still names as where it moved waits for the details of that one to go first; a later Alert Group that fires again after it keeps its row, without the reference (ON DELETE SET NULL).

func (*Queries) DeleteExpiredMemberships

func (q *Queries) DeleteExpiredMemberships(ctx context.Context, arg DeleteExpiredMembershipsParams) (int64, error)

DeleteExpiredMemberships deletes at most @batch_size Alerts inside Alert Groups that ended before @cutoff; rows another transaction holds wait for the next run.

func (*Queries) DeleteTimer

func (q *Queries) DeleteTimer(ctx context.Context, arg DeleteTimerParams) error

DeleteTimer stops an Alert Group's timer of a kind.

func (*Queries) EnsureCounter

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

EnsureCounter creates the Organization's row of alert_group_counters on first use.

func (*Queries) FindOpenGroup

func (q *Queries) FindOpenGroup(ctx context.Context, arg FindOpenGroupParams) (int64, error)

FindOpenGroup finds the open Alert Group of a Route and Group key values; Alert Groups moved to the Default route are left out, as alert_groups_open_key leaves them out.

func (*Queries) FindReopenableGroup

func (q *Queries) FindReopenableGroup(ctx context.Context, arg FindReopenableGroupParams) (int64, error)

FindReopenableGroup finds the latest system-resolved Alert Group of a Route and Group key values whose Reopen window is still open at now.

func (*Queries) GetDefaultRouteID

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

GetDefaultRouteID reads the id of the Default route.

func (*Queries) GetGroup

func (q *Queries) GetGroup(ctx context.Context, arg GetGroupParams) (GetGroupRow, error)

GetGroup reads an Alert Group by public_id with its Route, the #N of the Alert Group it fires again after, the label of its latest Replacement, the Alerts still firing in it, retention.alert_details, its Owner and Snooze, and, when a person resolved it, the open Alert Group of the same Route and key that takes part in grouping (C-10.FR-7), and whether its Route was deleted, which Unresolve needs. Urgency is derived from the Route and organization.critical_is_urgent as they are now (C-08.FR-6), so that marking a Route urgent or changing the setting shows on open Alert Groups at once without changing them. It has a Delivery problem (C-13.FR-12) when a delivery of it is Not delivered or deleted in the messenger, waits for a Broken Destination, or has a Thread not attached. Its next notice is the earliest of its ack_timeout and reminder timers (C-17.FR-9): an empty kind and the zero time 0001-01-01 when it has none. A Reminder waits for its Owner's answer while it is acknowledged, a Reminder was sent and the Owner has not answered since the last one (C-17.FR-10).

func (*Queries) GetGroupID

func (q *Queries) GetGroupID(ctx context.Context, arg GetGroupIDParams) (GetGroupIDRow, error)

GetGroupID reads the id of an Alert Group by public_id, with when it was resolved and retention.alert_details, which decide whether its details are removed.

func (*Queries) GetGroupKey

func (q *Queries) GetGroupKey(ctx context.Context, arg GetGroupKeyParams) (GetGroupKeyRow, error)

GetGroupKey reads the Route and the Group key of an Alert Group, for its related Alert Groups.

func (*Queries) GetGroupRef

func (q *Queries) GetGroupRef(ctx context.Context, arg GetGroupRefParams) (GetGroupRefRow, error)

GetGroupRef names an Alert Group by id: its public_id and #N.

func (*Queries) GetGroupTimer

func (q *Queries) GetGroupTimer(ctx context.Context, arg GetGroupTimerParams) (time.Time, error)

GetGroupTimer reads the deadline of an Alert Group's timer of a kind, after the Alert Group is locked: a timer fired after another change moved it finds a deadline other than the one it was claimed with.

func (*Queries) GetGroupingSettings

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

SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors The queries of the Alert Group lifecycle. Only this package writes alert_groups, alert_group_alerts, timeline_entries, notes and alert_group_counters (lint 2). Times are business times passed in from Go. GetGroupingSettings reads the Organization settings grouping needs: critical is Urgent and the Instance labels.

func (*Queries) GetLastReminderSeq

func (q *Queries) GetLastReminderSeq(ctx context.Context, arg GetLastReminderSeqParams) (int64, error)

GetLastReminderSeq reads the lifecycle event number of the last Reminder of an Alert Group: a reminder, or a notices_missed that stands for Reminders, which mentions the Owner (C-17.FR-5, FR-7).

func (*Queries) GetListSettings

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

GetListSettings reads what the list, the reads of one Alert Group and the Snooze presets need of the Organization: retention.alert_details, organization.time_zone, organization.workday_start and organization.week_start.

func (*Queries) GetRetentionPeriods

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

Retention (C-09.FR-16; design/db/schema.md §6) deletes in batches on the Leader, the rows that already qualify only, so that running it twice deletes nothing more. Details go first: the Alerts inside Alert Groups that ended retention.alert_details ago; then the summary rows resolved retention.alert_group_summaries ago, with their Notes, timers, deliveries and queue rows by cascade. GetRetentionPeriods reads retention.alert_details and retention.alert_group_summaries, in days.

func (*Queries) GetRoutePolicy

func (q *Queries) GetRoutePolicy(ctx context.Context, arg GetRoutePolicyParams) (GetRoutePolicyRow, error)

GetRoutePolicy reads the policy of a Route, deleted or not, that an existing Alert Group belongs to.

func (*Queries) GetSnapshotReceivedAt

func (q *Queries) GetSnapshotReceivedAt(ctx context.Context, arg GetSnapshotReceivedAtParams) (time.Time, error)

GetSnapshotReceivedAt reads when the Stored Snapshot behind a change was received, for the latency of its delivery.

func (*Queries) GetTimerPolicy

func (q *Queries) GetTimerPolicy(ctx context.Context, arg GetTimerPolicyParams) (GetTimerPolicyRow, error)

GetTimerPolicy reads the timer policy of a Route, deleted or not, at the time a timer is set or fires (C-17): the ack timeout, the Reminders and auto-unacknowledge.

func (*Queries) GetUserTimeZone

func (q *Queries) GetUserTimeZone(ctx context.Context, arg GetUserTimeZoneParams) (string, error)

GetUserTimeZone reads the profile time zone of a User, in which the Snooze presets of that User's Commands end; empty while the profile follows the browser.

func (*Queries) InsertDowntimeEntries

func (q *Queries) InsertDowntimeEntries(ctx context.Context, arg InsertDowntimeEntriesParams) error

InsertDowntimeEntries records "Muster was unavailable from … to …" on Alert Groups.

func (*Queries) InsertGroup

func (q *Queries) InsertGroup(ctx context.Context, arg InsertGroupParams) (int64, error)

InsertGroup creates an Alert Group, firing.

func (*Queries) InsertMemberships

func (q *Queries) InsertMemberships(ctx context.Context, arg InsertMembershipsParams) error

InsertMemberships adds Alerts to Alert Groups, firing.

func (*Queries) InsertNote

func (q *Queries) InsertNote(ctx context.Context, arg InsertNoteParams) error

InsertNote records a Note with the event_seq of its note_added lifecycle event (C-10.FR-8).

func (*Queries) InsertTimelineEntry

func (q *Queries) InsertTimelineEntry(ctx context.Context, arg InsertTimelineEntryParams) error

InsertTimelineEntry records one Timeline entry: a lifecycle event or a system entry.

func (*Queries) IntegrationStatistics

func (q *Queries) IntegrationStatistics(ctx context.Context, arg IntegrationStatisticsParams) ([]IntegrationStatisticsRow, error)

IntegrationStatistics aggregates the Alert Groups per Integration — one with Alerts from several counts for each — only the Integrations @integration_ids when set.

func (*Queries) IsActiveUser

func (q *Queries) IsActiveUser(ctx context.Context, arg IsActiveUserParams) (bool, error)

IsActiveUser reports whether a User can still own an Alert Group: a disabled or deleted Owner has no acknowledgements.

func (*Queries) ListAlertGroupKeys

func (q *Queries) ListAlertGroupKeys(ctx context.Context, arg ListAlertGroupKeysParams) ([]ListAlertGroupKeysRow, error)

ListAlertGroupKeys lists the Alertmanager groupKeys that listed each Alert during its current or last firing.

func (*Queries) ListChangedAlerts

func (q *Queries) ListChangedAlerts(ctx context.Context, arg ListChangedAlertsParams) ([]ListChangedAlertsRow, error)

ListChangedAlerts reads the Alerts of a Snapshot's changes, with the Route and Severity level routing stamped.

func (*Queries) ListFiringMemberships

func (q *Queries) ListFiringMemberships(ctx context.Context, arg ListFiringMembershipsParams) ([]ListFiringMembershipsRow, error)

ListFiringMemberships reads where the Alerts fire: an Alert lives in at most one Alert Group at a time.

func (*Queries) ListGroupAlerts

func (q *Queries) ListGroupAlerts(ctx context.Context, arg ListGroupAlertsParams) ([]ListGroupAlertsRow, error)

ListGroupAlerts lists the Alerts of an Alert Group, firing first, then those that ended, after a position; @rank is 0 for firing and 1 for ended.

func (*Queries) ListGroupFiringAlerts

func (q *Queries) ListGroupFiringAlerts(ctx context.Context, arg ListGroupFiringAlertsParams) ([]ListGroupFiringAlertsRow, error)

ListGroupFiringAlerts lists the Alerts firing in Alert Groups with their labels: the comparison of a Replacement, and the tails that a Grace period end groups again.

func (*Queries) ListGroupsChangedAsc

func (q *Queries) ListGroupsChangedAsc(ctx context.Context, arg ListGroupsChangedAscParams) ([]ListGroupsChangedAscRow, error)

ListGroupsChangedAsc reads a batch of the Alert Group list, earliest change first, after the cursor when given.

func (*Queries) ListGroupsChangedDesc

func (q *Queries) ListGroupsChangedDesc(ctx context.Context, arg ListGroupsChangedDescParams) ([]ListGroupsChangedDescRow, error)

ListGroupsChangedDesc reads a batch of the Alert Group list, latest change first, after the cursor when given.

func (*Queries) ListGroupsStartedAsc

func (q *Queries) ListGroupsStartedAsc(ctx context.Context, arg ListGroupsStartedAscParams) ([]ListGroupsStartedAscRow, error)

ListGroupsStartedAsc reads a batch of the Alert Group list, oldest start first, after the cursor when given.

func (*Queries) ListGroupsStartedDesc

func (q *Queries) ListGroupsStartedDesc(ctx context.Context, arg ListGroupsStartedDescParams) ([]ListGroupsStartedDescRow, error)

The Alert Group list (C-09.FR-13) reads the summary rows in one of four orders. Every query runs with the plan of its parameters (Store.CustomPlans), so that the filters left unset fold away and the planner picks the index of the filters that are set: the partial open index for the default tab, the started or changed index for a range, the trigram indexes for text, the jsonb_path_ops index for = label Matchers, the unique (org_id, number) for #N. The time range selects lifetimes that overlap it — created_at < to AND (resolved_at IS NULL OR resolved_at >= from), written with the status that the CHECK ties to resolved_at, so that the open index and alert_groups_resolved_idx serve it — and is ignored for a number. Label Matchers other than = with a value are matched in Go on common_labels, after these conditions; urgency and the newer open Alert Group are derived as in GetGroup. The Owner filter, with @owner_set, selects the Alert Groups the User @owner_id owns, or nobody owns when it is null. The Delivery problem (C-13.FR-12) and the next notice (C-17.FR-9) are derived as in GetGroup; @unclaimed selects the Unclaimed Alert Groups or the others (C-09.FR-13). ListGroupsStartedDesc reads a batch of the Alert Group list, newest start first, after the cursor when given.

func (*Queries) ListIntegrationRefs

func (q *Queries) ListIntegrationRefs(ctx context.Context, arg ListIntegrationRefsParams) ([]ListIntegrationRefsRow, error)

ListIntegrationRefs names Integrations, deleted ones included.

func (*Queries) ListIntegrationsByPublicID

func (q *Queries) ListIntegrationsByPublicID(ctx context.Context, arg ListIntegrationsByPublicIDParams) ([]ListIntegrationsByPublicIDRow, error)

ListIntegrationsByPublicID names Integrations, deleted ones included, by public_id.

func (*Queries) ListJoinedDuringSnooze

func (q *Queries) ListJoinedDuringSnooze(ctx context.Context, arg ListJoinedDuringSnoozeParams) ([]string, error)

ListJoinedDuringSnooze lists the fingerprints of the Alerts that joined an Alert Group during its current Snooze (C-09.FR-8): after the last Timeline entry that took it into snoozed from another status, and, when that entry is a Reopen into snoozed, the Alerts that reopened it.

func (*Queries) ListOpenGroupIDs

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

ListOpenGroupIDs lists the open Alert Groups of the Organization, for the downtime entries.

func (*Queries) ListOpenGroupsOfRoute

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

ListOpenGroupsOfRoute lists the open Alert Groups of a Route.

func (*Queries) ListOwnedGroups

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

ListOwnedGroups lists the Alert Groups a User owns, for the release of a disabled or deleted Owner (C-03.FR-13): acknowledged by them, or resolved by the system inside a Reopen window that would reopen them acknowledged by them.

func (*Queries) ListRelatedGroups

func (q *Queries) ListRelatedGroups(ctx context.Context, arg ListRelatedGroupsParams) ([]ListRelatedGroupsRow, error)

ListRelatedGroups lists the other Alert Groups of a Route with the same Group key values, newest first, after the cursor when given (C-09.FR-20; alert_groups_related_idx).

func (*Queries) ListRoutePublicIDs

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

ListRoutePublicIDs lists the Routes that are not deleted, for the zero series of muster_alert_groups.

func (*Queries) ListRoutesByPublicID

func (q *Queries) ListRoutesByPublicID(ctx context.Context, arg ListRoutesByPublicIDParams) ([]ListRoutesByPublicIDRow, error)

ListRoutesByPublicID names Routes, deleted ones included, by public_id: the Route filter of the list and of the statistics.

func (*Queries) ListServiceAccountRefs

func (q *Queries) ListServiceAccountRefs(ctx context.Context, arg ListServiceAccountRefsParams) ([]ListServiceAccountRefsRow, error)

ListServiceAccountRefs names Service accounts, deleted ones included.

func (*Queries) ListStatisticsIntegrations

func (q *Queries) ListStatisticsIntegrations(ctx context.Context, arg ListStatisticsIntegrationsParams) ([]ListStatisticsIntegrationsRow, error)

ListStatisticsIntegrations lists the subjects of the statistics per Integration, as ListStatisticsRoutes does.

func (*Queries) ListStatisticsRoutes

func (q *Queries) ListStatisticsRoutes(ctx context.Context, arg ListStatisticsRoutesParams) ([]ListStatisticsRoutesRow, error)

ListStatisticsRoutes lists the subjects of the statistics per Route: those that are not deleted and @with_ids (the deleted ones with Alert Groups in the period), or only @only_ids when set.

func (*Queries) ListTimelineAsc

func (q *Queries) ListTimelineAsc(ctx context.Context, arg ListTimelineAscParams) ([]ListTimelineAscRow, error)

ListTimelineAsc reads the Timeline entries of an Alert Group, oldest first, after a position.

func (*Queries) ListTimelineDeliveryEvents

func (q *Queries) ListTimelineDeliveryEvents(ctx context.Context, arg ListTimelineDeliveryEventsParams) ([]ListTimelineDeliveryEventsRow, error)

ListTimelineDeliveryEvents reads the delivery events of an Alert Group for the Timeline, newest first with @descending, after a position.

func (*Queries) ListTimelineDesc

func (q *Queries) ListTimelineDesc(ctx context.Context, arg ListTimelineDescParams) ([]ListTimelineDescRow, error)

The Timeline merges three sources by (at, source, id): its entries (source 0), Notes (1) and delivery events (2). A page reads up to @lim of each after the position of the previous page and keeps the first @lim of the merge. ListTimelineDesc reads the Timeline entries of an Alert Group, newest first, before a position.

func (*Queries) ListTimelineNotes

func (q *Queries) ListTimelineNotes(ctx context.Context, arg ListTimelineNotesParams) ([]ListTimelineNotesRow, error)

ListTimelineNotes reads the Notes of an Alert Group for the Timeline, newest first with @descending, after a position.

func (*Queries) ListUserRefs

func (q *Queries) ListUserRefs(ctx context.Context, arg ListUserRefsParams) ([]ListUserRefsRow, error)

ListUserRefs names Users, deleted ones included.

func (*Queries) ListUsersByPublicID

func (q *Queries) ListUsersByPublicID(ctx context.Context, arg ListUsersByPublicIDParams) ([]ListUsersByPublicIDRow, error)

ListUsersByPublicID names Users, deleted ones included, by public_id: the Owner filter of the list.

func (*Queries) LockActiveUser

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

LockActiveUser locks the row of a User who acknowledges, FOR SHARE, while they are active: a disable or a delete of that User, which releases their acknowledgements, waits for the acknowledgement or makes it refused.

func (*Queries) LockCounter

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

LockCounter locks the Organization's counter row: every change that makes an Alert Group open — a creation or a Reopen — takes it first, so that two of them never race for one Route and Group key.

func (*Queries) LockDefaultRoute

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

LockDefaultRoute locks the Default route FOR SHARE, for the Alerts whose Route was deleted meanwhile.

func (*Queries) LockGroups

func (q *Queries) LockGroups(ctx context.Context, arg LockGroupsParams) ([]LockGroupsRow, error)

LockGroups locks Alert Groups for a change, in id order, so that two transactions never wait for each other. The lock is FOR NO KEY UPDATE, as a change never deletes an Alert Group or changes its id: it excludes every other change, but not the FOR KEY SHARE that a foreign-key check of a row referencing the Alert Group takes, such as a delivery row its transaction updates a second time while the dispatcher waits for that row (the lock order of the delivery worker, internal/delivery/worker.go).

func (*Queries) LockRouteForMove

func (q *Queries) LockRouteForMove(ctx context.Context, arg LockRouteForMoveParams) (LockRouteForMoveRow, error)

LockRouteForMove locks a Route that is not deleted against grouping, which takes it FOR SHARE, while its open Alert Groups move to the Default route.

func (*Queries) LockRoutes

func (q *Queries) LockRoutes(ctx context.Context, arg LockRoutesParams) ([]LockRoutesRow, error)

LockRoutes locks the Routes that are not deleted FOR SHARE before grouping creates or joins an Alert Group on them, in id order: a deletion, which locks its Route FOR NO KEY UPDATE and then counts the open Alert Groups, waits for the Snapshot, or commits first and leaves the Route out of the result.

func (*Queries) MoveMemberships

func (q *Queries) MoveMemberships(ctx context.Context, arg MoveMembershipsParams) error

MoveMemberships ends firing memberships whose Alerts were grouped again, into the Alert Group that took them.

func (*Queries) NextNumber

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

NextNumber takes the next #N; a rollback returns it, so no gap appears.

func (*Queries) NotifyTimers

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

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

func (*Queries) PeekGroup

func (q *Queries) PeekGroup(ctx context.Context, arg PeekGroupParams) (PeekGroupRow, error)

PeekGroup reads, without a lock, the Route and the Grace period of an Alert Group, so that the end of its Grace period finds the Alert Groups it changes before it locks them all in id order.

func (*Queries) ResolveMemberships

func (q *Queries) ResolveMemberships(ctx context.Context, arg ResolveMembershipsParams) error

ResolveMemberships ends firing memberships whose Alerts resolved, each with its reason.

func (*Queries) RollbackGrouping

func (q *Queries) RollbackGrouping(ctx context.Context) error

RollbackGrouping undoes grouping back to SavepointGrouping, releasing the Alert Group locks it took since.

func (*Queries) RouteStatistics

func (q *Queries) RouteStatistics(ctx context.Context, arg RouteStatisticsParams) ([]RouteStatisticsRow, error)

The statistics (C-09.FR-15) aggregate the summary rows that started in [@range_from, @range_to): per subject, and per subject and day of start in the time zone @time_zone. Time to resolve counts the resolved ones, time to acknowledge those acknowledged at least once; both are seconds, their median and 95th percentile interpolated, and 0 when their count is 0. RouteStatistics aggregates the Alert Groups per Route, only the Routes @route_ids when set.

func (*Queries) SaveGroup

func (q *Queries) SaveGroup(ctx context.Context, arg SaveGroupParams) error

SaveGroup writes the state of an Alert Group after a change.

func (*Queries) SavepointGrouping

func (q *Queries) SavepointGrouping(ctx context.Context) error

SavepointGrouping marks where grouping that joins open Alert Groups without the counter row starts, so that it can start again under the counter row when an Alert Group it found turns out to need a creation or a Reopen.

func (*Queries) UpdateMemberships

func (q *Queries) UpdateMemberships(ctx context.Context, arg UpdateMembershipsParams) error

UpdateMemberships records the startsAt of a Continuation and the annotations as last seen.

func (*Queries) UpsertTimer

func (q *Queries) UpsertTimer(ctx context.Context, arg UpsertTimerParams) error

UpsertTimer sets the deadline of an Alert Group's timer of a kind, with the number of the notice or Reminder it stands for, free of any lease.

func (*Queries) WithTx

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

type ResolveMembershipsParams

type ResolveMembershipsParams struct {
	EndedAt     time.Time
	OrgID       int64
	Ids         []int64
	Reasons     []string
	ReasonTexts []string
}

type RouteStatisticsParams

type RouteStatisticsParams struct {
	TimeZone  string
	OrgID     int64
	RangeFrom time.Time
	RangeTo   time.Time
	RouteIds  []int64
}

type RouteStatisticsRow

type RouteStatisticsRow struct {
	SubjectID       int64
	Day             pgtype.Date
	Total           bool
	AlertGroupCount int64
	ResolveCount    int64
	ResolveMedian   float64
	ResolveP95      float64
	AckCount        int64
	AckMedian       float64
	AckP95          float64
}

type SaveGroupParams

type SaveGroupParams struct {
	RouteID                        int64
	MovedFromRouteID               pgtype.Int8
	Title                          string
	TitleFromGroupKey              bool
	Summary                        pgtype.Text
	CommonLabels                   []byte
	CommonAnnotations              []byte
	IntegrationIds                 []int64
	Status                         string
	SeverityLevel                  string
	Urgent                         bool
	OwnerUserID                    pgtype.Int8
	AcknowledgedAt                 pgtype.Timestamptz
	SnoozeUntil                    pgtype.Timestamptz
	SnoozeNoEnd                    bool
	SnoozedWhileUrgent             bool
	SnoozedByUserID                pgtype.Int8
	SnoozedByServiceAccountID      pgtype.Int8
	FiringAlertCount               int64
	ResolvedAlertCount             int64
	ReopenCount                    int64
	ResolvedAt                     pgtype.Timestamptz
	ResolvedByKind                 pgtype.Text
	ResolvedByUserID               pgtype.Int8
	ResolvedByServiceAccountID     pgtype.Int8
	ResolveReason                  pgtype.Text
	ResolveReasonText              pgtype.Text
	ReopenDeadline                 pgtype.Timestamptz
	PriorStatus                    pgtype.Text
	PriorOwnerUserID               pgtype.Int8
	PriorSnoozeUntil               pgtype.Timestamptz
	PriorSnoozeNoEnd               pgtype.Bool
	PriorSnoozedWhileUrgent        pgtype.Bool
	PriorSnoozedByUserID           pgtype.Int8
	PriorSnoozedByServiceAccountID pgtype.Int8
	GraceDeadline                  pgtype.Timestamptz
	EventSeq                       int64
	LastChangedAt                  time.Time
	FirstAcknowledgedAt            pgtype.Timestamptz
	FirstPublishedAt               pgtype.Timestamptz
	AckTimeoutStartedAt            pgtype.Timestamptz
	AckTimeoutNoticesSent          int64
	Unclaimed                      bool
	RemindersSent                  int64
	RemindersUnanswered            int64
	LastReminderAt                 pgtype.Timestamptz
	OwnerAnsweredAt                pgtype.Timestamptz
	OrgID                          int64
	ID                             int64
}

type UpdateMembershipsParams

type UpdateMembershipsParams struct {
	OrgID       int64
	Ids         []int64
	StartsAts   []time.Time
	Annotations [][]byte
}

type UpsertTimerParams

type UpsertTimerParams struct {
	OrgID        int64
	AlertGroupID int64
	Kind         string
	Deadline     time.Time
	NoticeNumber pgtype.Int8
	Now          time.Time
}

Jump to

Keyboard shortcuts

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