annotations.go 912 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package annotations
  2. import (
  3. "time"
  4. "github.com/grafana/grafana/pkg/components/simplejson"
  5. )
  6. type Repository interface {
  7. Save(item *Item) error
  8. }
  9. var repositoryInstance Repository
  10. func GetRepository() Repository {
  11. return repositoryInstance
  12. }
  13. func SetRepository(rep Repository) {
  14. repositoryInstance = rep
  15. }
  16. type ItemType string
  17. const (
  18. AlertType ItemType = "alert"
  19. )
  20. type Item struct {
  21. Id int64 `json:"id"`
  22. OrgId int64 `json:"orgId"`
  23. PanelLinkId string `json:"panelLinkId"`
  24. Type ItemType `json:"type"`
  25. Title string `json:"title"`
  26. Text string `json:"text"`
  27. Metric string `json:"metric"`
  28. AlertId int64 `json:"alertId"`
  29. UserId int64 `json:"userId"`
  30. PrevState string `json:"prevState"`
  31. NewState string `json:"newState"`
  32. Timestamp time.Time `json:"timestamp"`
  33. Data *simplejson.Json `json:"data"`
  34. }