remove case
This commit is contained in:
		
							parent
							
								
									a17786e98c
								
							
						
					
					
						commit
						bf7b45bcc6
					
				|  | @ -79,11 +79,12 @@ func patch(obj any, path string, value any) error { | ||||||
| 	if !found { | 	if !found { | ||||||
| 		err = setValue(obj, first, value) | 		err = setValue(obj, first, value) | ||||||
| 		return err | 		return err | ||||||
|  | 	} else if first == "" { | ||||||
|  | 		err = patch(obj, rest, value) | ||||||
|  | 		return err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	switch v := obj.(type) { | 	switch v := obj.(type) { | ||||||
| 	case *FeedResponse: |  | ||||||
| 		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: | ||||||
|  | @ -105,7 +106,7 @@ func (f *FeedResponse) Patch(instr *instruction) { | ||||||
| 	// TODO: need to handle each type of instruction separately: add,
 | 	// TODO: need to handle each type of instruction separately: add,
 | ||||||
| 	// replace, remove, copy, move
 | 	// replace, remove, copy, move
 | ||||||
| 	log.Println("updating", instr.Path) | 	log.Println("updating", instr.Path) | ||||||
| 	err := patch(f, instr.Path, instr.Value) | 	err := patch(map[string]any(*f), instr.Path, instr.Value) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Println(err) | 		log.Println(err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue