MCPcopy Create free account
hub / github.com/Restream/reindexer / parseStructField

Function parseStructField

cjson/encoder.go:109–125  ·  view source on GitHub ↗
(sf reflect.StructField)

Source from the content-addressed store, hash-verified

107}
108
109func parseStructField(sf reflect.StructField) (name string, skip, omitEmpty bool) {
110 name, opts := splitStr(sf.Tag.Get("json"), ',')
111 if name == "-" || len(sf.PkgPath) != 0 {
112 skip = true
113 } else if name == "" {
114 name = sf.Name
115 }
116
117 omitEmpty = strings.Contains(opts, "omitempty")
118
119 if !skip {
120 _, opts = splitStr(sf.Tag.Get("reindex"), ',')
121 skip = strings.Contains(opts, "joined") || strings.Contains(opts, "composite")
122 }
123
124 return
125}
126
127func (enc *Encoder) encodeStruct(v reflect.Value, rdser *Serializer, cache *ctagsWCache) error {
128 t := v.Type()

Callers 1

encodeStructMethod · 0.85

Calls 3

splitStrFunction · 0.85
GetMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected