You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
775 B

package common_models
import (
"encoding/json"
)
type Structure struct {
ThingId string `json:"thingId"`
Id int `json:"id"`
Name string `json:"name"`
SType string `json:"type"`
OrgId int `json:"orgId"` //结构物归属的组织ID
Latitude float64 `json:"latitude"` //纬度
Longitude float64 `json:"longitude"` //经度
}
type ThingStruct struct {
ThingId string `json:"thingId"`
Id int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
OrgId int `json:"orgId"`
}
// redis序列化
func (m *ThingStruct) MarshalBinary() (data []byte, err error) {
return json.Marshal(m)
}
// redis序列化
func (m *ThingStruct) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, m)
}