You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
775 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
  1. package models
  2. import "context"
  3. type Bridge struct {
  4. ID int `json:"id" db:"id"`
  5. Name string `json:"name" db:"name"`
  6. Driver DriverKind `json:"driver" db:"driver"`
  7. Address string `json:"address" db:"address"`
  8. Token string `json:"-" db:"token"`
  9. }
  10. type BridgeRepository interface {
  11. Find(ctx context.Context, id int) (Bridge, error)
  12. FetchAll(ctx context.Context) ([]Bridge, error)
  13. Save(ctx context.Context, bridge *Bridge) error
  14. Delete(ctx context.Context, bridge *Bridge) error
  15. }
  16. type DriverKind string
  17. var (
  18. DTHue DriverKind = "Hue"
  19. DTHue2 DriverKind = "Hue2"
  20. DTNanoLeaf DriverKind = "Nanoleaf"
  21. DTLIFX DriverKind = "LIFX"
  22. DTMill DriverKind = "Mill"
  23. )
  24. var ValidDriverKinds = []DriverKind{
  25. DTHue,
  26. DTNanoLeaf,
  27. }