[#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

View file

@ -33,3 +33,14 @@ func TypeFromV2(t object.Type) Type {
return TypeRegular
}
}
func (t Type) String() string {
return t.ToV2().String()
}
// TypeFromString parses Type from its string representation.
func TypeFromString(s string) Type {
return TypeFromV2(
object.TypeFromString(s),
)
}