(arrayBytes []byte)
| 272 | } |
| 273 | |
| 274 | func getArrayElementBounds(arrayBytes []byte) ([]arrayElementBounds, error) { |
| 275 | arrResult := gjson.ParseBytes(arrayBytes) |
| 276 | if !arrResult.IsArray() { |
| 277 | return nil, errors.New("expected a JSON array") |
| 278 | } |
| 279 | |
| 280 | elements := arrResult.Array() |
| 281 | bounds := make([]arrayElementBounds, len(elements)) |
| 282 | for i, elem := range elements { |
| 283 | if elem.Index < 0 { |
| 284 | return nil, errors.New("failed to determine array element index") |
| 285 | } |
| 286 | bounds[i] = arrayElementBounds{ |
| 287 | Start: elem.Index, |
| 288 | End: elem.Index + len(elem.Raw), |
| 289 | } |
| 290 | } |
| 291 | return bounds, nil |
| 292 | } |
| 293 | |
| 294 | func getKeepStart(bounds []arrayElementBounds, newEntryLen, maxTotalBytes int) int { |
| 295 | if maxTotalBytes <= 0 { |
no outgoing calls
no test coverage detected
searching dependent graphs…