MCPcopy
hub / github.com/pingcap/tidb / WriteToBufferInCsv

Method WriteToBufferInCsv

dumpling/export/sql_type.go:308–323  ·  view source on GitHub ↗

WriteToBufferInCsv implements Stringer.WriteToBufferInCsv

(bf *bytes.Buffer, escapeBackslash bool, opt *csvOption)

Source from the content-addressed store, hash-verified

306
307// WriteToBufferInCsv implements Stringer.WriteToBufferInCsv
308func (s *SQLTypeBytes) WriteToBufferInCsv(bf *bytes.Buffer, escapeBackslash bool, opt *csvOption) {
309 if s.RawBytes != nil {
310 bf.Write(opt.delimiter)
311 switch opt.binaryFormat {
312 case BinaryFormatHEX:
313 fmt.Fprintf(bf, "%x", s.RawBytes)
314 case BinaryFormatBase64:
315 bf.WriteString(base64.StdEncoding.EncodeToString(s.RawBytes))
316 default:
317 escapeCSV(s.RawBytes, bf, escapeBackslash, opt)
318 }
319 bf.Write(opt.delimiter)
320 } else {
321 bf.WriteString(opt.nullValue)
322 }
323}

Callers

nothing calls this directly

Calls 3

escapeCSVFunction · 0.85
WriteMethod · 0.65
WriteStringMethod · 0.45

Tested by

no test coverage detected