Documentation ¶
Index ¶
- func DumpBinaryRow(buffer []byte, columns []*Info, row chunk.Row, d *ResultEncoder) ([]byte, error)
- func DumpFlag(tp byte, flag uint16) uint16
- func DumpTextRow(buffer []byte, columns []*Info, row chunk.Row, d *ResultEncoder) ([]byte, error)
- type Info
- type ResultEncoder
- func (d *ResultEncoder) Clean()
- func (d *ResultEncoder) ColumnTypeInfoCharsetID(info *Info) uint16
- func (d *ResultEncoder) EncodeData(src []byte) []byte
- func (d *ResultEncoder) EncodeMeta(src []byte) []byte
- func (d *ResultEncoder) EncodeWith(src []byte, enc charset.Encoding) []byte
- func (d *ResultEncoder) UpdateDataEncoding(chsID uint16)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpBinaryRow ¶
DumpBinaryRow dumps a row to bytes.
func DumpTextRow ¶
DumpTextRow dumps a row to bytes.
Types ¶
type Info ¶
type Info struct { DefaultValue any Schema string Table string OrgTable string Name string OrgName string ColumnLength uint32 Charset uint16 Flag uint16 Decimal uint8 Type uint8 }
Info contains information of a column
func ConvertColumnInfo ¶
func ConvertColumnInfo(fld *resolve.ResultField) (ci *Info)
ConvertColumnInfo converts `*ast.ResultField` to `*Info`
func (*Info) Dump ¶
func (column *Info) Dump(buffer []byte, d *ResultEncoder) []byte
Dump dumps Info to bytes.
func (*Info) DumpWithDefault ¶
func (column *Info) DumpWithDefault(buffer []byte, d *ResultEncoder) []byte
DumpWithDefault dumps Info to bytes, including column defaults. This is used for ComFieldList responses.
type ResultEncoder ¶
type ResultEncoder struct {
// contains filtered or unexported fields
}
ResultEncoder encodes a column value to a byte slice.
func NewResultEncoder ¶
func NewResultEncoder(chs string) *ResultEncoder
NewResultEncoder creates a new ResultEncoder.
func (*ResultEncoder) Clean ¶
func (d *ResultEncoder) Clean()
Clean prevent the ResultEncoder from holding too much memory.
func (*ResultEncoder) ColumnTypeInfoCharsetID ¶
func (d *ResultEncoder) ColumnTypeInfoCharsetID(info *Info) uint16
ColumnTypeInfoCharsetID returns the charset ID for the column type info.
func (*ResultEncoder) EncodeData ¶
func (d *ResultEncoder) EncodeData(src []byte) []byte
EncodeData encodes bytes for row data. Note that the result should be consumed immediately.
func (*ResultEncoder) EncodeMeta ¶
func (d *ResultEncoder) EncodeMeta(src []byte) []byte
EncodeMeta encodes bytes for meta info like column names. Note that the result should be consumed immediately.
func (*ResultEncoder) EncodeWith ¶
func (d *ResultEncoder) EncodeWith(src []byte, enc charset.Encoding) []byte
EncodeWith encodes bytes with the given encoding.
func (*ResultEncoder) UpdateDataEncoding ¶
func (d *ResultEncoder) UpdateDataEncoding(chsID uint16)
UpdateDataEncoding updates the data encoding.