jsonName extracts the JSON name from a struct field or converts the field name to lowercase if no JSON tag is present.
(field reflect.StructField)
| 377 | // jsonName extracts the JSON name from a struct field or converts the field name |
| 378 | // to lowercase if no JSON tag is present. |
| 379 | func jsonName(field reflect.StructField) string { |
| 380 | name := strings.ToLower(field.Name) |
| 381 | if jsonName := field.Tag.Get("json"); jsonName != "" { |
| 382 | name = strings.Split(jsonName, ",")[0] |
| 383 | } |
| 384 | return name |
| 385 | } |
| 386 | |
| 387 | // everyPB traverses and processes a value using a path, building paths with |
| 388 | // PathBuffer, and applying a function to leaf nodes. |
no test coverage detected
searching dependent graphs…