Documentation
¶
Index ¶
- type Alert
- type AlertStatus
- type Metric
- type Service
- func (s *Service) CreateAlert(ctx context.Context, alert *Alert) error
- func (s *Service) CreateMetric(ctx context.Context, metric *Metric) error
- func (s *Service) GetAlerts(ctx context.Context, userID string) ([]*Alert, error)
- func (s *Service) GetMetrics(ctx context.Context, serviceName string) ([]*Metric, error)
- func (s *Service) SetDB(db *gorm.DB)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Description string `json:"description"`
UserID string `json:"user_id" gorm:"index;not null"`
Condition string `json:"condition" gorm:"not null"`
Status AlertStatus `json:"status" gorm:"default:0"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}
type AlertStatus ¶
type AlertStatus int
const ( AlertStatusActive AlertStatus = iota AlertStatusInactive AlertStatusTriggered )
func (AlertStatus) String ¶
func (a AlertStatus) String() string
type Metric ¶
type Metric struct {
ID uint `json:"id" gorm:"primaryKey"`
ServiceName string `json:"service_name" gorm:"index;not null"`
Name string `json:"name" gorm:"not null"`
Value float64 `json:"value"`
Unit string `json:"unit"`
Tags string `json:"tags"`
Timestamp time.Time `json:"timestamp"`
CreatedAt time.Time `json:"created_at"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService() *Service
func (*Service) CreateAlert ¶
func (*Service) CreateMetric ¶
func (*Service) GetMetrics ¶
Click to show internal directories.
Click to hide internal directories.