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

Function GetProperty

backend/core/utils/json.go:31–37  ·  view source on GitHub ↗
(object JsonObject, key string)

Source from the content-addressed store, hash-verified

29type JsonArray = []any
30
31func GetProperty[T any](object JsonObject, key string) (T, errors.Error) {
32 property, ok := object[key]
33 if !ok {
34 return *new(T), errors.Default.New(fmt.Sprintf("Missing property \"%s\"", key))
35 }
36 return Convert[T](property)
37}
38
39func GetItem[T any](array JsonArray, index int) (T, errors.Error) {
40 if index < 0 || index >= len(array) {

Callers

nothing calls this directly

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected