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

Function NewNumericFromJSONString

lib/go/thrift/numeric.go:100–116  ·  view source on GitHub ↗
(sValue string, isNull bool)

Source from the content-addressed store, hash-verified

98}
99
100func NewNumericFromJSONString(sValue string, isNull bool) Numeric {
101 if isNull {
102 return NewNullNumeric()
103 }
104 if sValue == JSON_INFINITY {
105 return INFINITY
106 }
107 if sValue == JSON_NEGATIVE_INFINITY {
108 return NEGATIVE_INFINITY
109 }
110 if sValue == JSON_NAN {
111 return NAN
112 }
113 iValue, _ := strconv.ParseInt(sValue, 10, 64)
114 dValue, _ := strconv.ParseFloat(sValue, 64)
115 return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNull}
116}
117
118func NewNullNumeric() Numeric {
119 return &numeric{iValue: 0, dValue: 0.0, sValue: "", isNil: true}

Callers 1

readNumericMethod · 0.85

Calls 1

NewNullNumericFunction · 0.85

Tested by

no test coverage detected