device.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. RecordId string `gorm:"column:record_id;size:32;index"`
  8. // which product the device belongs to
  9. ProductID string `gorm:"column:product_id;size:32;index"`
  10. // universal device identifier, generated from vendorid-productid-deviceserial
  11. DeviceIdentifier string `sql:"type:varchar(200);not null;unique;key"`
  12. // device secret which is auto generated by the platform
  13. DeviceSecret string `sql:"type:varchar(200);not null;"`
  14. // device key is used to auth a device
  15. DeviceKey string `sql:"type:varchar(200);not null;key;"`
  16. // device name
  17. DeviceName string `sql:"type:varchar(200);not null;"`
  18. // device desc
  19. DeviceDescription string `sql:"type:text;not null;"`
  20. // device version(the agent version)
  21. DeviceVersion string `sql:"type:text;not null;"`
  22. // vendor id
  23. VendorID string `gorm:"column:vendor_id;size:32;index"`
  24. //通讯模组名称
  25. ModuleName string
  26. }
  27. // DeviceQuery device query
  28. type DeviceQuery struct {
  29. Device
  30. ProductName string
  31. }
  32. // Devices
  33. type Devices struct {
  34. Device
  35. Status int
  36. }
  37. // DeviceChartData 设备数据图表
  38. type DeviceChartData struct {
  39. Dt string
  40. Count int
  41. }