parse data into the map or struct
(aliasTag string, out any, data map[string][]string, files ...map[string][]*multipart.FileHeader)
| 91 | |
| 92 | // parse data into the map or struct |
| 93 | func parse(aliasTag string, out any, data map[string][]string, files ...map[string][]*multipart.FileHeader) error { |
| 94 | ptrVal := reflect.ValueOf(out) |
| 95 | |
| 96 | // Get pointer value |
| 97 | if ptrVal.Kind() == reflect.Pointer { |
| 98 | ptrVal = ptrVal.Elem() |
| 99 | } |
| 100 | |
| 101 | // Parse into the map |
| 102 | if ptrVal.Kind() == reflect.Map && ptrVal.Type().Key().Kind() == reflect.String { |
| 103 | return parseToMap(ptrVal, data) |
| 104 | } |
| 105 | |
| 106 | // Parse into the struct |
| 107 | return parseToStruct(aliasTag, out, data, files...) |
| 108 | } |
| 109 | |
| 110 | // Parse data into the struct with gofiber/schema |
| 111 | func parseToStruct(aliasTag string, out any, data map[string][]string, files ...map[string][]*multipart.FileHeader) error { |