MCPcopy
hub / github.com/apache/devlake / GetItem

Function GetItem

backend/core/utils/json.go:39–44  ·  view source on GitHub ↗
(array JsonArray, index int)

Source from the content-addressed store, hash-verified

37}
38
39func GetItem[T any](array JsonArray, index int) (T, errors.Error) {
40 if index < 0 || index >= len(array) {
41 return *new(T), errors.Default.New(fmt.Sprintf("Index %d out of range", index))
42 }
43 return Convert[T](array[index])
44}
45
46// Convert converts value to type T. If value is a slice, it converts each element of the slice to type T.
47// Does not support nested slices.

Callers

nothing calls this directly

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected