MCPcopy Create free account
hub / github.com/pingcap/tidb / marshalArrayTo

Method marshalArrayTo

pkg/types/json_binary.go:363–377  ·  view source on GitHub ↗
(buf []byte)

Source from the content-addressed store, hash-verified

361}
362
363func (bj BinaryJSON) marshalArrayTo(buf []byte) ([]byte, error) {
364 elemCount := int(jsonEndian.Uint32(bj.Value))
365 buf = append(buf, '[')
366 for i := 0; i < elemCount; i++ {
367 if i != 0 {
368 buf = append(buf, ", "...)
369 }
370 var err error
371 buf, err = bj.ArrayGetElem(i).marshalTo(buf)
372 if err != nil {
373 return nil, errors.Trace(err)
374 }
375 }
376 return append(buf, ']'), nil
377}
378
379func (bj BinaryJSON) marshalObjTo(buf []byte) ([]byte, error) {
380 elemCount := int(jsonEndian.Uint32(bj.Value))

Callers 1

marshalToMethod · 0.95

Calls 2

ArrayGetElemMethod · 0.95
marshalToMethod · 0.80

Tested by

no test coverage detected