43 lines
992 B
Go
43 lines
992 B
Go
package meta
|
|
|
|
import (
|
|
"encoding/json"
|
|
"git.loafle.net/overflow/commons-go/core/util"
|
|
)
|
|
|
|
type MetaProbeStatus struct {
|
|
ID json.Number `json:"id,Number,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Key string `json:"key, omitempty"`
|
|
|
|
CreateDate *util.Timestamp `json:"createDate,omitempty"`
|
|
}
|
|
|
|
type MetaProbeStatusEnum int
|
|
|
|
const (
|
|
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = 1
|
|
MetaProbeStatusEnumNORMAL MetaProbeStatusEnum = 2
|
|
)
|
|
|
|
var (
|
|
metaProbeStatusEnumID = map[MetaProbeStatusEnum]string {
|
|
MetaProbeStatusEnumINITIAL: "INITIAL",
|
|
MetaProbeStatusEnumNORMAL: "NORMAL",
|
|
}
|
|
|
|
metaProbeStatusEnumKey = map[string]MetaProbeStatusEnum{
|
|
"INITIAL": MetaProbeStatusEnumINITIAL,
|
|
"NORMAL": MetaProbeStatusEnumNORMAL,
|
|
}
|
|
)
|
|
|
|
func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum {
|
|
return metaProbeStatusEnumKey[v.Key]
|
|
}
|
|
|
|
func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus {
|
|
return &MetaProbeStatus{
|
|
Key: metaProbeStatusEnumID[v],
|
|
}
|
|
} |