frostfs-api-go/v2/object/string.go
Leonard Lyubich 53e2756762 [#231] object: Implement string encode/decode methods on Type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00

29 lines
526 B
Go

package object
const (
typeRegularString = "Regular"
typeTombstoneString = "Tombstone"
typeStorageGroupString = "StorageGroup"
)
func (t Type) String() string {
switch t {
default:
return typeRegularString
case TypeTombstone:
return typeTombstoneString
case TypeStorageGroup:
return typeStorageGroupString
}
}
func TypeFromString(s string) Type {
switch s {
default:
return TypeRegular
case typeTombstoneString:
return TypeTombstone
case typeStorageGroupString:
return TypeStorageGroup
}
}