MCPcopy Index your code
hub / github.com/valyala/fastjson / GetStringBytes

Method GetStringBytes

parser.go:860–866  ·  view source on GitHub ↗

GetStringBytes returns string value by the given keys path. Array indexes may be represented as decimal numbers in keys. nil is returned for non-existing keys path or for invalid value type. The returned string is valid until Parse is called on the Parser returned v.

(keys ...string)

Source from the content-addressed store, hash-verified

858//
859// The returned string is valid until Parse is called on the Parser returned v.
860func (v *Value) GetStringBytes(keys ...string) []byte {
861 v = v.Get(keys...)
862 if v == nil || v.Type() != TypeString {
863 return nil
864 }
865 return s2b(v.s)
866}
867
868// GetBool returns bool value by the given keys path.
869//

Callers 13

TestValueGetTypedFunction · 0.80
TestValueGetFunction · 0.80
TestParserParseFunction · 0.80
TestParseBigObjectFunction · 0.80
testParseGetSerialFunction · 0.80
ExampleParser_ParseFunction · 0.80
ExampleValue_GetFunction · 0.80
benchmarkObjectGetFunction · 0.80
GetStringFunction · 0.80

Calls 3

GetMethod · 0.95
TypeMethod · 0.95
s2bFunction · 0.85

Tested by 11

TestValueGetTypedFunction · 0.64
TestValueGetFunction · 0.64
TestParserParseFunction · 0.64
TestParseBigObjectFunction · 0.64
testParseGetSerialFunction · 0.64
ExampleParser_ParseFunction · 0.64
ExampleValue_GetFunction · 0.64
benchmarkObjectGetFunction · 0.64