Switching Computers
This commit is contained in:
parent
ac4d008f57
commit
c64bda66f5
@ -28,15 +28,18 @@ func (b *DB) Load(path []string, dest any) error {
|
||||
fmt.Println("Loading Field:", fldName, "->", structFld.Type.Kind())
|
||||
switch structFld.Type.Kind() {
|
||||
case reflect.Pointer, reflect.Struct:
|
||||
var wrk reflect.Value
|
||||
var wrk interface{}
|
||||
var wrkV reflect.Value
|
||||
if structFld.Type.Kind() == reflect.Pointer {
|
||||
wrk2 := reflect.ValueOf(structFld)
|
||||
fmt.Println("wrk2:", reflect.TypeOf(wrk2.Interface()))
|
||||
fmt.Println(" It's a pointer to something")
|
||||
wrkV = reflect.New(structFld).Type()
|
||||
} else {
|
||||
wrk = reflect.New(reflect.TypeOf(structFld))
|
||||
fmt.Println(" It's a struct itself")
|
||||
wrkV = reflect.New(reflect.TypeOf(structFld))
|
||||
}
|
||||
fmt.Println("-> Recurse (struct)", reflect.TypeOf(wrk).Kind())
|
||||
err := b.Load(append(path, fldName), wrk)
|
||||
wrk = wrkV.Interface()
|
||||
fmt.Println("-> Recurse (struct)", reflect.TypeOf(wrk))
|
||||
err := b.Load(append(path, fldName), &wrk)
|
||||
if err != nil {
|
||||
if ret == nil {
|
||||
ret = err
|
||||
|
Loading…
Reference in New Issue
Block a user