MCPcopy Create free account
hub / github.com/buger/jsonparser / containerStart

Function containerStart

parser.go:2233–2252  ·  view source on GitHub ↗

SYS-REQ-112

(data []byte, open byte, keys ...string)

Source from the content-addressed store, hash-verified

2231
2232// SYS-REQ-112
2233func containerStart(data []byte, open byte, keys ...string) (int, error) {
2234 offset := 0
2235 if len(keys) > 0 {
2236 offset = searchKeys(data, keys...)
2237 if offset == -1 {
2238 return -1, KeyPathNotFoundError
2239 }
2240 }
2241
2242 tokenOffset := nextToken(data[offset:])
2243 if tokenOffset == -1 {
2244 return -1, KeyPathNotFoundError
2245 }
2246 offset += tokenOffset
2247
2248 if data[offset] != open {
2249 return -1, KeyPathNotFoundError
2250 }
2251 return offset, nil
2252}
2253
2254// SYS-REQ-112
2255func scanContainerLen(data []byte, offset int, open byte) (int, error) {

Callers 2

GetArrayLenFunction · 0.85
GetObjectLenFunction · 0.85

Calls 2

searchKeysFunction · 0.85
nextTokenFunction · 0.85

Tested by

no test coverage detected