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.
32 lines
626 B
32 lines
626 B
2 months ago
|
package models
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
type Structure struct {
|
||
|
ThingId string `json:"thingId"`
|
||
|
Id int `json:"id"`
|
||
|
Name string `json:"name"`
|
||
|
Type string `json:"type"`
|
||
|
OrgId int `json:"orgId"`
|
||
|
}
|
||
|
|
||
|
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)
|
||
|
}
|