MCPcopy Index your code
hub / github.com/tidwall/gjson / execStatic

Function execStatic

gjson.go:2818–2846  ·  view source on GitHub ↗

execStatic parses the path to find a static value. The input expects that the path already starts with a '!'

(json, path string)

Source from the content-addressed store, hash-verified

2816// execStatic parses the path to find a static value.
2817// The input expects that the path already starts with a '!'
2818func execStatic(json, path string) (pathOut, res string, ok bool) {
2819 name := path[1:]
2820 if len(name) > 0 {
2821 switch name[0] {
2822 case '{', '[', '"', '+', '-', '0', '1', '2', '3', '4', '5', '6', '7',
2823 '8', '9':
2824 _, res = parseSquash(name, 0)
2825 pathOut = name[len(res):]
2826 return pathOut, res, true
2827 }
2828 }
2829 for i := 1; i < len(path); i++ {
2830 if path[i] == '|' {
2831 pathOut = path[i:]
2832 name = path[1:i]
2833 break
2834 }
2835 if path[i] == '.' {
2836 pathOut = path[i:]
2837 name = path[1:i]
2838 break
2839 }
2840 }
2841 switch strings.ToLower(name) {
2842 case "true", "false", "null", "nan", "inf":
2843 return pathOut, name, true
2844 }
2845 return pathOut, res, false
2846}
2847
2848// execModifier parses the path to find a matching modifier function.
2849// The input expects that the path already starts with a '@'

Callers 1

GetFunction · 0.85

Calls 1

parseSquashFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…