package models import "encoding/json" type DeviceInfo struct { Id string `json:"id"` Name string `json:"name"` Structure Structure `json:"structure"` DeviceMeta DeviceMeta `json:"device_meta"` } type DeviceMeta struct { Id string `json:"id"` Name string `json:"name"` Model string `json:"model"` Properties []IotaProperty `json:"properties"` Capabilities []IotaCapability `json:"capabilities"` } // redis序列化 func (m *DeviceMeta) MarshalBinary() (data []byte, err error) { return json.Marshal(m) } // redis序列化 func (m *DeviceMeta) UnmarshalBinary(data []byte) error { return json.Unmarshal(data, m) } type IotaCapability struct { CapabilityCategoryId int `json:"capabilityCategoryId"` Id string `json:"id"` Name string `json:"name"` Properties []IotaProperty `json:"properties"` } type IotaProperty struct { Category string `json:"category"` Name string `json:"name"` ShowName string `json:"showName"` Unit string `json:"unit"` }