package common_models import ( "encoding/json" ) type IotaDevice struct { Id string `json:"id"` Name string `json:"name"` Properties string `json:"properties"` DeviceMetaId string `json:"deviceMetaId"` ThingId string `json:"thingId"` DeviceMeta DeviceMeta `json:"deviceMeta"` } // redis序列化 func (m *IotaDevice) MarshalBinary() (data []byte, err error) { return json.Marshal(m) } // redis序列化 func (m *IotaDevice) UnmarshalBinary(data []byte) error { return json.Unmarshal(data, m) }