device.go 823 B

1234567891011121314151617181920212223
  1. // device is a product instance, which is managed by our platform
  2. package models
  3. import "github.com/jinzhu/gorm"
  4. // Device device model
  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. }