column

package
v0.0.0-...-6e93ed8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpBinaryRow

func DumpBinaryRow(buffer []byte, columns []*Info, row chunk.Row, d *ResultEncoder) ([]byte, error)

DumpBinaryRow dumps a row to bytes.

func DumpFlag

func DumpFlag(tp byte, flag uint16) uint16

DumpFlag dumps flag of a column.

func DumpTextRow

func DumpTextRow(buffer []byte, columns []*Info, row chunk.Row, d *ResultEncoder) ([]byte, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL