MCPcopy Index your code
hub / github.com/bytebase/bytebase / GetValueWithKey

Function GetValueWithKey

backend/plugin/idp/util.go:7–19  ·  view source on GitHub ↗

GetValueWithKey returns the value of the key in the data.

(data map[string]any, key string)

Source from the content-addressed store, hash-verified

5
6// GetValueWithKey returns the value of the key in the data.
7func GetValueWithKey(data map[string]any, key string) any {
8 keys := strings.Split(key, ".")
9 value := data[keys[0]]
10
11 if len(keys) > 1 {
12 if subData, ok := value.(map[string]any); ok {
13 return GetValueWithKey(subData, strings.Join(keys[1:], "."))
14 }
15 return nil
16 }
17
18 return value
19}

Callers 4

UserInfoMethod · 0.92
UserInfoMethod · 0.92
TestGetValueWithKeyFunction · 0.85

Calls 1

JoinMethod · 0.80

Tested by 2

TestGetValueWithKeyFunction · 0.68