MCPcopy Create free account
hub / github.com/blues/note / addrMarshalerEncoder

Function addrMarshalerEncoder

jsonxt/encode.go:465–480  ·  view source on GitHub ↗
(e *encodeState, v reflect.Value, _ encOpts)

Source from the content-addressed store, hash-verified

463}
464
465func addrMarshalerEncoder(e *encodeState, v reflect.Value, _ encOpts) {
466 va := v.Addr()
467 if va.IsNil() {
468 e.WriteString("null")
469 return
470 }
471 m := va.Interface().(Marshaler)
472 b, err := m.MarshalJSON()
473 if err == nil {
474 // copy JSON into buffer, checking validity.
475 err = compact(&e.Buffer, b, true)
476 }
477 if err != nil {
478 e.error(&MarshalerError{v.Type(), err})
479 }
480}
481
482func textMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
483 if v.Kind() == reflect.Ptr && v.IsNil() {

Callers

nothing calls this directly

Calls 3

compactFunction · 0.85
MarshalJSONMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected