// Bytes returns the next bytes column value from the current row.
//
// The returned value is valid until the next call to Reader.
Bytes returns the next bytes column value from the current row.

The returned value is valid until the next call to Reader.
// Bytes returns the next bytes column value from the current row . // // The returned value is valid until the next call to Reader .
func (tr *Reader) Bytes() []byte {
	if tr.err != nil {
		return nil
	}
	b, err := tr.nextCol()
	if err != nil {
		tr.setColError("cannot read `bytes`", err)
		return nil
	}
	if !tr.needUnescape {
		return b
	}
	n := bytes.IndexByte(b, '\\')
	if n < 0 {
		return b
	}
	n++
	d := b[:n]
	b = b[n:]
	for len(b) > 0 {
		switch b[0] {
		case 'b':
			d[len(d)-1] = '\b'
		case 'f':
			d[len(d)-1] = '\f'
		case 'r':
			d[len(d)-1] = '\r'
		case 'n':
			d[len(d)-1] = '\n'
		case 't':
			d[len(d)-1] = '\t'
		case '0':
			d[len(d)-1] = 0
		case '\'':
			d[len(d)-1] = '\''
		case '\\':
			d[len(d)-1] = '\\'
		default:
			d[len(d)-1] = b[0]
		}
		b = b[1:]
		n = bytes.IndexByte(b, '\\')
		if n < 0 {
			d = append(d, b...)
			break
		}
		n++
		d = append(d, b[:n]...)
		b = b[n:]
	}
	return d
}
func ( tr * Reader ) Bytes ( ) [ ] byte { if tr . err != nil { return nil } b , err := tr . nextCol ( ) if err != nil { tr . setColError ( " " , err ) return nil } if ! tr . needUnescape { return b } n := bytes . IndexByte ( b , '\\' ) if n < 0 { return b } n ++ d := b [ : n ] b = b [ n : ] for len ( b ) > 0 { switch b [ 0 ] { case 'b' : d [ len ( d ) - 1 ] = '\b' case 'f' : d [ len ( d ) - 1 ] = '\f' case 'r' : d [ len ( d ) - 1 ] = '\r' case 'n' : d [ len ( d ) - 1 ] = '\n' case 't' : d [ len ( d ) - 1 ] = '\t' case '0' : d [ len ( d ) - 1 ] = 0 case '\'' : d [ len ( d ) - 1 ] = '\'' case '\\' : d [ len ( d ) - 1 ] = '\\' default : d [ len ( d ) - 1 ] = b [ 0 ] } b = b [ 1 : ] n = bytes . IndexByte ( b , '\\' ) if n < 0 { d = append ( d , b ... ) break } n ++ d = append ( d , b [ : n ] ... ) b = b [ n : ] } return d }
Bytes returns the next bytes column value from the current row.
Bytes returns the next bytes column value from the current row .
// Fast path - nothing to unescape. // Unescape b // Nothing to unescape in the current column. // Slow path - in-place unescaping compatible with ClickHouse.