support slices in extractor, longer term need to look at all types
This commit is contained in:
		| @@ -34,12 +34,20 @@ func extractValue(v reflect.Type) *registry.Value { | |||||||
| 		Type: v.Name(), | 		Type: v.Name(), | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if v.Kind() == reflect.Struct { | 	switch v.Kind() { | ||||||
|  | 	case reflect.Struct: | ||||||
| 		for i := 0; i < v.NumField(); i++ { | 		for i := 0; i < v.NumField(); i++ { | ||||||
| 			val := extractValue(v.Field(i).Type) | 			val := extractValue(v.Field(i).Type) | ||||||
| 			val.Name = v.Field(i).Name | 			val.Name = v.Field(i).Name | ||||||
| 			arg.Values = append(arg.Values, val) | 			arg.Values = append(arg.Values, val) | ||||||
| 		} | 		} | ||||||
|  | 	case reflect.Slice: | ||||||
|  | 		p := v.Elem() | ||||||
|  | 		if p.Kind() == reflect.Ptr { | ||||||
|  | 			p = p.Elem() | ||||||
|  | 		} | ||||||
|  | 		arg.Type = "[]" + p.Name() | ||||||
|  | 		arg.Values = append(arg.Values, extractValue(v.Elem())) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return arg | 	return arg | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user