MCPcopy
hub / github.com/ugorji/go / kStructNoOmitempty

Method kStructNoOmitempty

codec/encode.go:504–526  ·  view source on GitHub ↗
(f *codecFnInfo, rv reflect.Value)

Source from the content-addressed store, hash-verified

502}
503
504func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) {
505 var tisfi []*structFieldInfo
506 if f.ti.toArray || e.h.StructToArray { // toArray
507 tisfi = f.ti.sfi.source()
508 e.arrayStart(len(tisfi))
509 for _, si := range tisfi {
510 e.arrayElem()
511 e.encodeValue(si.path.field(rv), nil)
512 }
513 e.arrayEnd()
514 } else {
515 tisfi = e.kStructSfi(f)
516 e.mapStart(len(tisfi))
517 keytyp := f.ti.keyType
518 for _, si := range tisfi {
519 e.mapElemKey()
520 e.kStructFieldKey(keytyp, si.path.encNameAsciiAlphaNum, si.encName)
521 e.mapElemValue()
522 e.encodeValue(si.path.field(rv), nil)
523 }
524 e.mapEnd()
525 }
526}
527
528func (e *Encoder) kStructFieldKey(keyType valueType, encNameAsciiAlphaNum bool, encName string) {
529 encStructFieldKey(encName, e.e, e.w(), keyType, encNameAsciiAlphaNum, e.js)

Callers

nothing calls this directly

Calls 12

arrayStartMethod · 0.95
arrayElemMethod · 0.95
encodeValueMethod · 0.95
arrayEndMethod · 0.95
kStructSfiMethod · 0.95
mapStartMethod · 0.95
mapElemKeyMethod · 0.95
kStructFieldKeyMethod · 0.95
mapElemValueMethod · 0.95
mapEndMethod · 0.95
fieldMethod · 0.80
sourceMethod · 0.45

Tested by

no test coverage detected