github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/object/string.go (about)

     1  package object
     2  
     3  import (
     4  	object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc"
     5  )
     6  
     7  // String returns string representation of Type.
     8  func (t Type) String() string {
     9  	return TypeToGRPCField(t).String()
    10  }
    11  
    12  // FromString parses Type from a string representation.
    13  // It is a reverse action to String().
    14  //
    15  // Returns true if s was parsed successfully.
    16  func (t *Type) FromString(s string) bool {
    17  	var g object.ObjectType
    18  
    19  	ok := g.FromString(s)
    20  
    21  	if ok {
    22  		*t = TypeFromGRPCField(g)
    23  	}
    24  
    25  	return ok
    26  }
    27  
    28  // TypeFromString converts string to Type.
    29  //
    30  // Deprecated: use FromString method.
    31  func TypeFromString(s string) (t Type) {
    32  	t.FromString(s)
    33  	return
    34  }
    35  
    36  // String returns string representation of MatchType.
    37  func (t MatchType) String() string {
    38  	return MatchTypeToGRPCField(t).String()
    39  }
    40  
    41  // FromString parses MatchType from a string representation.
    42  // It is a reverse action to String().
    43  //
    44  // Returns true if s was parsed successfully.
    45  func (t *MatchType) FromString(s string) bool {
    46  	var g object.MatchType
    47  
    48  	ok := g.FromString(s)
    49  
    50  	if ok {
    51  		*t = MatchTypeFromGRPCField(g)
    52  	}
    53  
    54  	return ok
    55  }