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.

32 lines
743 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 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. DTNanoLeaf DriverKind = "Nanoleaf"
  20. DTLIFX DriverKind = "LIFX"
  21. DTMill DriverKind = "Mill"
  22. )
  23. var ValidDriverKinds = []DriverKind{
  24. DTHue,
  25. DTNanoLeaf,
  26. }