MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getJSONName

Function getJSONName

tsunami/util/marshal.go:81–87  ·  view source on GitHub ↗

getJSONName returns the field name to use for JSON mapping

(field reflect.StructField)

Source from the content-addressed store, hash-verified

79
80// getJSONName returns the field name to use for JSON mapping
81func 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
90func setValue(field reflect.Value, value any) error {

Callers 2

MapToStructFunction · 0.70
StructToMapFunction · 0.70

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected