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

Function containerStart

parser.go:2120–2139  ·  view source on GitHub ↗

SYS-REQ-112

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

Source from the content-addressed store, hash-verified

2118
2119// SYS-REQ-112
2120func containerStart(data []byte, open byte, keys ...string) (int, error) {
2121 offset := 0
2122 if len(keys) > 0 {
2123 offset = searchKeys(data, keys...)
2124 if offset == -1 {
2125 return -1, KeyPathNotFoundError
2126 }
2127 }
2128
2129 tokenOffset := nextToken(data[offset:])
2130 if tokenOffset == -1 {
2131 return -1, KeyPathNotFoundError
2132 }
2133 offset += tokenOffset
2134
2135 if data[offset] != open {
2136 return -1, KeyPathNotFoundError
2137 }
2138 return offset, nil
2139}
2140
2141// SYS-REQ-112
2142func 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