datasource.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. const (
  7. DS_GRAPHITE = "graphite"
  8. DS_INFLUXDB = "influxdb"
  9. DS_ES = "es"
  10. DS_ACCESS_DIRECT = "direct"
  11. DS_ACCESS_PROXY = "proxy"
  12. )
  13. // Typed errors
  14. var (
  15. ErrDataSourceNotFound = errors.New("Data source not found")
  16. )
  17. type DsType string
  18. type DsAccess string
  19. type DataSource struct {
  20. Id int64
  21. AccountId int64
  22. Name string
  23. Type DsType
  24. Access DsAccess
  25. Url string
  26. Password string
  27. User string
  28. Database string
  29. BasicAuth bool
  30. Created time.Time
  31. Updated time.Time
  32. }
  33. type GetDataSourcesQuery struct {
  34. AccountId int64
  35. Result []*DataSource
  36. }
  37. type GetDataSourceByIdQuery struct {
  38. Id int64
  39. AccountId int64
  40. Result DataSource
  41. }
  42. type AddDataSourceCommand struct {
  43. AccountId int64
  44. Name string
  45. Type DsType
  46. Access DsAccess
  47. Url string
  48. Password string
  49. Database string
  50. User string
  51. }
  52. type UpdateDataSourceCommand struct {
  53. Id int64
  54. AccountId int64
  55. Name string
  56. Type DsType
  57. Access DsAccess
  58. Url string
  59. Password string
  60. User string
  61. Database string
  62. }
  63. type DeleteDataSourceCommand struct {
  64. Id int64
  65. AccountId int64
  66. }