frostfs-sdk-go/api/object/string.go
Evgenii Stratonikov 328d214d2d
All checks were successful
DCO / DCO (pull_request) Successful in 26s
Tests and linters / Tests (pull_request) Successful in 46s
Tests and linters / Lint (pull_request) Successful in 1m52s
[#317] api: Revert easyproto marshaler usage
It has caused a noticeable degradation in node.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-09 11:46:09 +03:00

51 lines
1.1 KiB
Go

package object
import (
object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc"
)
// String returns string representation of Type.
func (t Type) String() string {
return TypeToGRPCField(t).String()
}
// FromString parses Type from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (t *Type) FromString(s string) bool {
g, ok := object.ObjectType_value[s]
if ok {
*t = TypeFromGRPCField(object.ObjectType(g))
}
return ok
}
// TypeFromString converts string to Type.
//
// Deprecated: use FromString method.
func TypeFromString(s string) (t Type) {
t.FromString(s)
return
}
// String returns string representation of MatchType.
func (t MatchType) String() string {
return MatchTypeToGRPCField(t).String()
}
// FromString parses MatchType from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (t *MatchType) FromString(s string) bool {
g, ok := object.MatchType_value[s]
if ok {
*t = MatchTypeFromGRPCField(object.MatchType(g))
}
return ok
}