MCPcopy Index your code
hub / github.com/riverqueue/river / getArrayElementBounds

Function getArrayElementBounds

riverlog/river_log.go:274–292  ·  view source on GitHub ↗
(arrayBytes []byte)

Source from the content-addressed store, hash-verified

272}
273
274func 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
294func getKeepStart(bounds []arrayElementBounds, newEntryLen, maxTotalBytes int) int {
295 if maxTotalBytes <= 0 {

Callers 1

appendLogDataWithCapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…