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.
25 lines
586 B
25 lines
586 B
package common_models
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type DataUnit struct {
|
|
Name string `json:"name"`
|
|
Dimension string `json:"dimension"`
|
|
Description string `json:"description"`
|
|
Coef float64 `json:"coef"`
|
|
Base bool `json:"base"`
|
|
Alternative interface{} `json:"alternative"`
|
|
}
|
|
type DataUnitArray []DataUnit
|
|
|
|
// redis序列化
|
|
func (m *DataUnitArray) MarshalBinary() (data []byte, err error) {
|
|
return json.Marshal(m)
|
|
}
|
|
|
|
// redis序列化
|
|
func (m *DataUnitArray) UnmarshalBinary(data []byte) error {
|
|
return json.Unmarshal(data, m)
|
|
}
|
|
|