MCPcopy Create free account
hub / github.com/apache/thrift / StringToTypeId

Method StringToTypeId

lib/go/thrift/json_protocol.go:541–571  ·  view source on GitHub ↗
(fieldType string)

Source from the content-addressed store, hash-verified

539}
540
541func (p *TJSONProtocol) StringToTypeId(fieldType string) (TType, error) {
542 switch fieldType {
543 case "tf":
544 return TType(BOOL), nil
545 case "i8":
546 return TType(BYTE), nil
547 case "i16":
548 return TType(I16), nil
549 case "i32":
550 return TType(I32), nil
551 case "i64":
552 return TType(I64), nil
553 case "dbl":
554 return TType(DOUBLE), nil
555 case "str":
556 return TType(STRING), nil
557 case "rec":
558 return TType(STRUCT), nil
559 case "map":
560 return TType(MAP), nil
561 case "set":
562 return TType(SET), nil
563 case "lst":
564 return TType(LIST), nil
565 case "uid":
566 return TType(UUID), nil
567 }
568
569 e := fmt.Errorf("Unknown type identifier: %s", fieldType)
570 return TType(STOP), NewTProtocolExceptionWithType(INVALID_DATA, e)
571}
572
573// Return the minimum number of bytes a type will consume on the wire
574func (p *TJSONProtocol) getMinSerializedSize(ttype TType) int32 {

Callers 3

ReadFieldBeginMethod · 0.95
ReadMapBeginMethod · 0.95
ParseElemListBeginMethod · 0.95

Calls 2

TTypeTypeAlias · 0.70

Tested by

no test coverage detected