[#231] object: Implement string encode/decode methods on Type

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-17 18:46:19 +03:00
parent 0f04087543
commit 53e2756762
3 changed files with 50 additions and 0 deletions

29
v2/object/string.go Normal file
View file

@ -0,0 +1,29 @@
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
}
}