// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 package db import ( "database/sql/driver" "fmt" "github.com/jackc/pgx/v5/pgtype" ) type AlertSeverity string const ( AlertSeverityInfo AlertSeverity = "info" AlertSeverityWarning AlertSeverity = "warning" AlertSeverityCritical AlertSeverity = "critical" ) func (e *AlertSeverity) Scan(src interface{}) error { switch s := src.(type) { case []byte: *e = AlertSeverity(s) case string: *e = AlertSeverity(s) default: return fmt.Errorf("unsupported scan type for AlertSeverity: %T", src) } return nil } type NullAlertSeverity struct { AlertSeverity AlertSeverity `json:"alert_severity"` Valid bool `json:"valid"` // Valid is true if AlertSeverity is not NULL } // Scan implements the Scanner interface. func (ns *NullAlertSeverity) Scan(value interface{}) error { if value == nil { ns.AlertSeverity, ns.Valid = "", false return nil } ns.Valid = true return ns.AlertSeverity.Scan(value) } // Value implements the driver Valuer interface. func (ns NullAlertSeverity) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } return string(ns.AlertSeverity), nil } type CheckType string const ( CheckTypeHttp CheckType = "http" CheckTypePing CheckType = "ping" CheckTypeTcp CheckType = "tcp" ) func (e *CheckType) Scan(src interface{}) error { switch s := src.(type) { case []byte: *e = CheckType(s) case string: *e = CheckType(s) default: return fmt.Errorf("unsupported scan type for CheckType: %T", src) } return nil } type NullCheckType struct { CheckType CheckType `json:"check_type"` Valid bool `json:"valid"` // Valid is true if CheckType is not NULL } // Scan implements the Scanner interface. func (ns *NullCheckType) Scan(value interface{}) error { if value == nil { ns.CheckType, ns.Valid = "", false return nil } ns.Valid = true return ns.CheckType.Scan(value) } // Value implements the driver Valuer interface. func (ns NullCheckType) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } return string(ns.CheckType), nil } type IncidentStatus string const ( IncidentStatusOpen IncidentStatus = "open" IncidentStatusAcknowledged IncidentStatus = "acknowledged" IncidentStatusResolved IncidentStatus = "resolved" ) func (e *IncidentStatus) Scan(src interface{}) error { switch s := src.(type) { case []byte: *e = IncidentStatus(s) case string: *e = IncidentStatus(s) default: return fmt.Errorf("unsupported scan type for IncidentStatus: %T", src) } return nil } type NullIncidentStatus struct { IncidentStatus IncidentStatus `json:"incident_status"` Valid bool `json:"valid"` // Valid is true if IncidentStatus is not NULL } // Scan implements the Scanner interface. func (ns *NullIncidentStatus) Scan(value interface{}) error { if value == nil { ns.IncidentStatus, ns.Valid = "", false return nil } ns.Valid = true return ns.IncidentStatus.Scan(value) } // Value implements the driver Valuer interface. func (ns NullIncidentStatus) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } return string(ns.IncidentStatus), nil } type TargetType string const ( TargetTypeService TargetType = "service" TargetTypeInfra TargetType = "infra" ) func (e *TargetType) Scan(src interface{}) error { switch s := src.(type) { case []byte: *e = TargetType(s) case string: *e = TargetType(s) default: return fmt.Errorf("unsupported scan type for TargetType: %T", src) } return nil } type NullTargetType struct { TargetType TargetType `json:"target_type"` Valid bool `json:"valid"` // Valid is true if TargetType is not NULL } // Scan implements the Scanner interface. func (ns *NullTargetType) Scan(value interface{}) error { if value == nil { ns.TargetType, ns.Valid = "", false return nil } ns.Valid = true return ns.TargetType.Scan(value) } // Value implements the driver Valuer interface. func (ns NullTargetType) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } return string(ns.TargetType), nil } type AlertRule struct { ID pgtype.UUID `json:"id"` CheckID pgtype.UUID `json:"check_id"` Name string `json:"name"` Threshold float64 `json:"threshold"` Operator string `json:"operator"` ForDuration int64 `json:"for_duration"` Severity AlertSeverity `json:"severity"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` } type Check struct { ID pgtype.UUID `json:"id"` TargetID pgtype.UUID `json:"target_id"` Type CheckType `json:"type"` IntervalSeconds int32 `json:"interval_seconds"` TimeoutSeconds int32 `json:"timeout_seconds"` IsActive bool `json:"is_active"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` } type Incident struct { ID pgtype.UUID `json:"id"` AlertRuleID pgtype.UUID `json:"alert_rule_id"` Status IncidentStatus `json:"status"` StartTime pgtype.Timestamptz `json:"start_time"` EndTime pgtype.Timestamptz `json:"end_time"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` } type Metric struct { Time pgtype.Timestamptz `json:"time"` CheckID pgtype.UUID `json:"check_id"` Value float64 `json:"value"` Tags []byte `json:"tags"` } type Target struct { ID pgtype.UUID `json:"id"` Name string `json:"name"` Type TargetType `json:"type"` Config []byte `json:"config"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` }