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

Function textMarshalerEncoder

jsonxt/encode.go:482–493  ·  view source on GitHub ↗
(e *encodeState, v reflect.Value, opts encOpts)

Source from the content-addressed store, hash-verified

480}
481
482func textMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
483 if v.Kind() == reflect.Ptr && v.IsNil() {
484 e.WriteString("null")
485 return
486 }
487 m := v.Interface().(encoding.TextMarshaler)
488 b, err := m.MarshalText()
489 if err != nil {
490 e.error(&MarshalerError{v.Type(), err})
491 }
492 e.stringBytes(b, opts.escapeHTML)
493}
494
495func addrTextMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
496 va := v.Addr()

Callers

nothing calls this directly

Calls 2

stringBytesMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected