github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/refs/string.go (about) 1 package refs 2 3 import ( 4 refs "github.com/TrueCloudLab/frostfs-api-go/v2/refs/grpc" 5 ) 6 7 // String returns string representation of ChecksumType. 8 func (t ChecksumType) String() string { 9 return ChecksumTypeToGRPC(t).String() 10 } 11 12 // FromString parses ChecksumType from a string representation. 13 // It is a reverse action to String(). 14 // 15 // Returns true if s was parsed successfully. 16 func (t *ChecksumType) FromString(s string) bool { 17 var g refs.ChecksumType 18 19 ok := g.FromString(s) 20 21 if ok { 22 *t = ChecksumTypeFromGRPC(g) 23 } 24 25 return ok 26 } 27 28 // String returns string representation of SignatureScheme. 29 func (t SignatureScheme) String() string { 30 return refs.SignatureScheme(t).String() 31 } 32 33 // FromString parses SignatureScheme from a string representation. 34 // It is a reverse action to String(). 35 // 36 // Returns true if s was parsed successfully. 37 func (t *SignatureScheme) FromString(s string) bool { 38 var g refs.SignatureScheme 39 40 ok := g.FromString(s) 41 42 if ok { 43 *t = SignatureScheme(g) 44 } 45 46 return ok 47 }