more debugging/logging

This commit is contained in:
filifa 2024-07-11 21:53:13 -05:00
parent 8c8f2b4f8f
commit 1b133fa865
1 changed files with 4 additions and 2 deletions

View File

@ -72,13 +72,15 @@ func setValue(obj any, key string, value any) error {
func patch(obj any, path string, value any) error { func patch(obj any, path string, value any) error {
var err error var err error
first, rest, found := strings.Cut(path, "/") first, rest, found := strings.Cut(path, "/")
log.Println(first, rest)
if !found { if !found {
setValue(obj, first, value) err = setValue(obj, first, value)
return err
} }
switch v := obj.(type) { switch v := obj.(type) {
case *FeedResponse: case *FeedResponse:
err = patch((*v)[first], rest, value) err = patch(map[string]any(*v), rest, value)
case map[string]any: case map[string]any:
err = patch(v[first], rest, value) err = patch(v[first], rest, value)
case []any: case []any: