mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Add claude code support
This commit is contained in:
23
internal/util/translator.go
Normal file
23
internal/util/translator.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package util
|
||||
|
||||
import "github.com/tidwall/gjson"
|
||||
|
||||
func Walk(value gjson.Result, path, field string, paths *[]string) {
|
||||
switch value.Type {
|
||||
case gjson.JSON:
|
||||
value.ForEach(func(key, val gjson.Result) bool {
|
||||
var childPath string
|
||||
if path == "" {
|
||||
childPath = key.String()
|
||||
} else {
|
||||
childPath = path + "." + key.String()
|
||||
}
|
||||
if key.String() == field {
|
||||
*paths = append(*paths, childPath)
|
||||
}
|
||||
Walk(val, childPath, field, paths)
|
||||
return true
|
||||
})
|
||||
case gjson.String, gjson.Number, gjson.True, gjson.False, gjson.Null:
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user