device.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. type Devices struct {
  32. Device
  33. Status int
  34. }
  35. // DeviceChartData 设备数据图表
  36. type DeviceChartData struct {
  37. Dt string
  38. Count int
  39. }