2020-12-17 15:46:19 +00:00
|
|
|
package object
|
|
|
|
|
2021-06-18 12:27:01 +00:00
|
|
|
import (
|
2023-03-07 10:38:56 +00:00
|
|
|
object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
2020-12-17 15:46:19 +00:00
|
|
|
)
|
|
|
|
|
2021-06-18 12:27:01 +00:00
|
|
|
// String returns string representation of Type.
|
2020-12-17 15:46:19 +00:00
|
|
|
func (t Type) String() string {
|
2021-06-18 12:27:01 +00:00
|
|
|
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 {
|
|
|
|
var g object.ObjectType
|
|
|
|
|
|
|
|
ok := g.FromString(s)
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
*t = TypeFromGRPCField(g)
|
2020-12-17 15:46:19 +00:00
|
|
|
}
|
2021-06-18 12:27:01 +00:00
|
|
|
|
|
|
|
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()
|
2020-12-17 15:46:19 +00:00
|
|
|
}
|
|
|
|
|
2021-06-18 12:27:01 +00:00
|
|
|
// 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 {
|
|
|
|
var g object.MatchType
|
|
|
|
|
|
|
|
ok := g.FromString(s)
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
*t = MatchTypeFromGRPCField(g)
|
2020-12-17 15:46:19 +00:00
|
|
|
}
|
2021-06-18 12:27:01 +00:00
|
|
|
|
|
|
|
return ok
|
2020-12-17 15:46:19 +00:00
|
|
|
}
|