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.

30 lines
679 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
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. DTNanoLeaf DriverKind = "Nanoleaf"
  20. )
  21. var ValidDriverKinds = []DriverKind{
  22. DTHue,
  23. DTNanoLeaf,
  24. }