getJSONName returns the field name to use for JSON mapping
(field reflect.StructField)
| 124 | |
| 125 | // getJSONName returns the field name to use for JSON mapping |
| 126 | func getJSONName(field reflect.StructField) string { |
| 127 | tag := field.Tag.Get("json") |
| 128 | if tag == "" || tag == "-" { |
| 129 | return field.Name |
| 130 | } |
| 131 | return strings.Split(tag, ",")[0] |
| 132 | } |
| 133 | |
| 134 | // setValue attempts to set a reflect.Value with a given interface{} value |
| 135 | func setValue(field reflect.Value, value any) error { |
no test coverage detected