model/meta/MetaServiceType.go
crusader 364679d149 ing
2018-09-12 13:26:56 +09:00

72 lines
1.9 KiB
Go

package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaServiceType 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 MetaServiceTypeEnum int
const (
MetaServiceTypeEnumUNKNOWN MetaServiceTypeEnum = iota + 1
MetaServiceTypeEnumNetwork
MetaServiceTypeEnumDirectory
MetaServiceTypeEnumMonitoring
MetaServiceTypeEnumDatabase
MetaServiceTypeEnumNoSQL
MetaServiceTypeEnumMail
MetaServiceTypeEnumSearch
MetaServiceTypeEnumWeb
MetaServiceTypeEnumWAS
)
var (
metaServiceTypeEnumID = map[MetaServiceTypeEnum]string{
MetaServiceTypeEnumUNKNOWN: "UNKNOWN",
MetaServiceTypeEnumNetwork: "NETWORK",
MetaServiceTypeEnumMonitoring: "MONITORING",
MetaServiceTypeEnumDirectory: "DIRECTORY",
MetaServiceTypeEnumDatabase: "DATABASE",
MetaServiceTypeEnumNoSQL: "NOSQL",
MetaServiceTypeEnumMail: "MAIL",
MetaServiceTypeEnumSearch: "SEARCH",
MetaServiceTypeEnumWeb: "WEB",
MetaServiceTypeEnumWAS: "WAS",
}
metaServiceTypeEnumKey = map[string]MetaServiceTypeEnum{
"UNKNOWN": MetaServiceTypeEnumUNKNOWN,
"NETWORK": MetaServiceTypeEnumNetwork,
"MONITORING": MetaServiceTypeEnumMonitoring,
"DIRECTORY": MetaServiceTypeEnumDirectory,
"DATABASE": MetaServiceTypeEnumDatabase,
"NOSQL": MetaServiceTypeEnumNoSQL,
"MAIL": MetaServiceTypeEnumMail,
"SEARCH": MetaServiceTypeEnumSearch,
"WEB": MetaServiceTypeEnumWeb,
"WAS": MetaServiceTypeEnumWAS,
}
)
func (e MetaServiceTypeEnum) String() string {
return metaServiceTypeEnumID[e]
}
func ToMetaServiceTypeEnum(v *MetaServiceType) MetaServiceTypeEnum {
return metaServiceTypeEnumKey[v.Key]
}
func ToMetaServiceType(v MetaServiceTypeEnum) *MetaServiceType {
return &MetaServiceType{
Key: metaServiceTypeEnumID[v],
}
}