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 MetaServiceTypeEnumDatabase MetaServiceTypeEnumNoSQL MetaServiceTypeEnumMail MetaServiceTypeEnumSearch MetaServiceTypeEnumWeb MetaServiceTypeEnumWAS ) var ( metaServiceTypeEnumID = map[MetaServiceTypeEnum]string{ MetaServiceTypeEnumUNKNOWN: "UNKNOWN", MetaServiceTypeEnumNetwork: "NETWORK", MetaServiceTypeEnumDatabase: "DATABASE", MetaServiceTypeEnumNoSQL: "NOSQL", MetaServiceTypeEnumMail: "MAIL", MetaServiceTypeEnumSearch: "SEARCH", MetaServiceTypeEnumWeb: "WEB", MetaServiceTypeEnumWAS: "WAS", } metaServiceTypeEnumKey = map[string]MetaServiceTypeEnum{ "UNKNOWN": MetaServiceTypeEnumUNKNOWN, "NETWORK": MetaServiceTypeEnumNetwork, "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], } }