device.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import "github.com/jinzhu/gorm"
  3. // Device device model
  4. // device is a product instance, which is managed by our platform
  5. type Device struct {
  6. gorm.Model
  7. // which product the device belongs to
  8. ProductID int32
  9. // universal device identifier, generated from vendorid-productid-deviceserial
  10. DeviceIdentifier string `sql:"type:varchar(200);not null;unique;key"`
  11. // device secret which is auto generated by the platform
  12. DeviceSecret string `sql:"type:varchar(200);not null;"`
  13. // device key is used to auth a device
  14. DeviceKey string `sql:"type:varchar(200);not null;key;"`
  15. // device name
  16. DeviceName string `sql:"type:varchar(200);not null;"`
  17. // device desc
  18. DeviceDescription string `sql:"type:text;not null;"`
  19. // device version(the agent version)
  20. DeviceVersion string `sql:"type:text;not null;"`
  21. // vendor id
  22. VendorID uint
  23. //通讯模组名称
  24. ModuleName string
  25. }
  26. // DeviceQuery device query
  27. type DeviceQuery struct {
  28. Device
  29. ProductName string
  30. }
  31. // Devices
  32. type Devices struct {
  33. Device
  34. Status int
  35. }
  36. // DeviceChartData 设备数据图表
  37. type DeviceChartData struct {
  38. Dt string
  39. Count int
  40. }