device.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // DeviceChartData 设备数据图表
  32. type DeviceChartData struct {
  33. Dt string
  34. Count int
  35. }