getJSONName returns the field name to use for JSON mapping
(field reflect.StructField)
| 79 | |
| 80 | // getJSONName returns the field name to use for JSON mapping |
| 81 | func getJSONName(field reflect.StructField) string { |
| 82 | tag := field.Tag.Get("json") |
| 83 | if tag == "" || tag == "-" { |
| 84 | return field.Name |
| 85 | } |
| 86 | return strings.Split(tag, ",")[0] |
| 87 | } |
| 88 | |
| 89 | // setValue attempts to set a reflect.Value with a given interface{} value |
| 90 | func setValue(field reflect.Value, value any) error { |
no test coverage detected