mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-06 05:17:38 +03:00
Fix merge objects
This commit is contained in:
parent
b55d1c78b3
commit
2238a05966
3 changed files with 50 additions and 6 deletions
20
common/json/internal/contextjson/keys.go
Normal file
20
common/json/internal/contextjson/keys.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package json
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/sagernet/sing/common"
|
||||
)
|
||||
|
||||
func ObjectKeys(object reflect.Type) []string {
|
||||
switch object.Kind() {
|
||||
case reflect.Pointer:
|
||||
return ObjectKeys(object.Elem())
|
||||
case reflect.Struct:
|
||||
default:
|
||||
panic("invalid non-struct input")
|
||||
}
|
||||
return common.Map(cachedTypeFields(object).list, func(field field) string {
|
||||
return field.name
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue