test_driver

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindNull          byte = 0
	KindInt64         byte = 1
	KindUint64        byte = 2
	KindFloat32       byte = 3
	KindFloat64       byte = 4
	KindString        byte = 5
	KindBytes         byte = 6
	KindBinaryLiteral byte = 7 // Used for BIT / HEX literals.
	KindMysqlDecimal  byte = 8
	KindMysqlDuration byte = 9
	KindMysqlEnum     byte = 10
	KindMysqlBit      byte = 11 // Used for BIT table column values.
	KindMysqlSet      byte = 12
	KindMysqlTime     byte = 13
	KindInterface     byte = 14
	KindMinNotNull    byte = 15
	KindMaxValue      byte = 16
	KindRaw           byte = 17
	KindMysqlJSON     byte = 18
)

Kind constants.

View Source
const DefaultFsp = int8(0)

DefaultFsp is the default digit of fractional seconds part. MySQL use 0 as the default Fsp.

Variables

View Source
var ZeroBinaryLiteral = BinaryLiteral{}

ZeroBinaryLiteral is a BinaryLiteral literal with zero value.

Functions

func Abs

func Abs(n int64) int64

func DefaultTypeForValue

func DefaultTypeForValue(value interface{}, tp *types.FieldType, charset string, collate string)

DefaultTypeForValue returns the default FieldType for the value.

func SetBinChsClnFlag

func SetBinChsClnFlag(ft *types.FieldType)

SetBinChsClnFlag sets charset, collation as 'binary' and adds binaryFlag to FieldType.

func StrLenOfInt64Fast

func StrLenOfInt64Fast(x int64) int

StrLenOfInt64Fast efficiently calculate the string character lengths of an int64 as input

func StrLenOfUint64Fast

func StrLenOfUint64Fast(x uint64) int

StrLenOfUint64Fast efficiently calculate the string character lengths of an uint64 as input

Types

type BinaryLiteral

type BinaryLiteral []byte

BinaryLiteral is the internal type for storing bit / hex literal type.

func ParseBitStr

func ParseBitStr(s string) (BinaryLiteral, error)

ParseBitStr parses bit string. The string format can be b'val', B'val' or 0bval, val must be 0 or 1. See https://dev.mysql.com/doc/refman/5.7/en/bit-value-literals.html

func ParseHexStr

func ParseHexStr(s string) (BinaryLiteral, error)

ParseHexStr parses hexadecimal string literal. See https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html

func (BinaryLiteral) String

func (b BinaryLiteral) String() string

String implements fmt.Stringer interface.

func (BinaryLiteral) ToBitLiteralString

func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string

ToBitLiteralString returns the bit literal representation for the literal.

func (BinaryLiteral) ToString

func (b BinaryLiteral) ToString() string

ToString returns the string representation for the literal.

type BitLiteral

type BitLiteral BinaryLiteral

BitLiteral is the bit literal type.

func NewBitLiteral

func NewBitLiteral(s string) (BitLiteral, error)

NewBitLiteral parses bit string as BitLiteral type.

func (BitLiteral) ToString

func (b BitLiteral) ToString() string

ToString implement ast.BinaryLiteral interface

type Datum

type Datum struct {
	// contains filtered or unexported fields
}

Datum is a data box holds different kind of data. It has better performance and is easier to use than `interface{}`.

func MakeDatums

func MakeDatums(args ...interface{}) []Datum

MakeDatums creates datum slice from interfaces.

func NewBytesDatum

func NewBytesDatum(b []byte) (d Datum)

NewBytesDatum creates a new Datum from a byte slice.

func NewDatum

func NewDatum(in interface{}) (d Datum)

NewDatum creates a new Datum from an interface{}.

func NewStringDatum

func NewStringDatum(s string) (d Datum)

NewStringDatum creates a new Datum from a string.

func (*Datum) GetBinaryLiteral

func (d *Datum) GetBinaryLiteral() BinaryLiteral

GetBinaryLiteral gets Bit value

func (*Datum) GetBytes

func (d *Datum) GetBytes() []byte

GetBytes gets bytes value.

func (*Datum) GetFloat32

func (d *Datum) GetFloat32() float32

GetFloat32 gets float32 value.

func (*Datum) GetFloat64

func (d *Datum) GetFloat64() float64

GetFloat64 gets float64 value.

func (*Datum) GetInt64

func (d *Datum) GetInt64() int64

GetInt64 gets int64 value.

func (*Datum) GetInterface

func (d *Datum) GetInterface() interface{}

GetInterface gets interface value.

func (*Datum) GetMysqlDecimal

func (d *Datum) GetMysqlDecimal() *MyDecimal

GetMysqlDecimal gets decimal value

func (*Datum) GetString

func (d *Datum) GetString() string

GetString gets string value.

func (*Datum) GetUint64

func (d *Datum) GetUint64() uint64

GetUint64 gets uint64 value.

func (*Datum) GetValue

func (d *Datum) GetValue() interface{}

GetValue gets the value of the datum of any kind.

func (*Datum) Kind

func (d *Datum) Kind() byte

Kind gets the kind of the datum.

func (*Datum) SetBinaryLiteral

func (d *Datum) SetBinaryLiteral(b BinaryLiteral)

SetBinaryLiteral sets Bit value

func (*Datum) SetBytes

func (d *Datum) SetBytes(b []byte)

SetBytes sets bytes value to datum.

func (*Datum) SetBytesAsString

func (d *Datum) SetBytesAsString(b []byte)

SetBytesAsString sets bytes value to datum as string type.

func (*Datum) SetFloat32

func (d *Datum) SetFloat32(f float32)

SetFloat32 sets float32 value.

func (*Datum) SetFloat64

func (d *Datum) SetFloat64(f float64)

SetFloat64 sets float64 value.

func (*Datum) SetInt64

func (d *Datum) SetInt64(i int64)

SetInt64 sets int64 value.

func (*Datum) SetInterface

func (d *Datum) SetInterface(x interface{})

SetInterface sets interface to datum.

func (*Datum) SetMysqlDecimal

func (d *Datum) SetMysqlDecimal(b *MyDecimal)

SetMysqlDecimal sets decimal value

func (*Datum) SetNull

func (d *Datum) SetNull()

SetNull sets datum to nil.

func (*Datum) SetString

func (d *Datum) SetString(s string)

SetString sets string value.

func (*Datum) SetUint64

func (d *Datum) SetUint64(i uint64)

SetUint64 sets uint64 value.

func (*Datum) SetValue

func (d *Datum) SetValue(val interface{})

SetValue sets any kind of value.

type HexLiteral

type HexLiteral BinaryLiteral

HexLiteral is the hex literal type.

func NewHexLiteral

func NewHexLiteral(s string) (HexLiteral, error)

NewHexLiteral parses hexadecimal string as HexLiteral type.

func (HexLiteral) ToString

func (b HexLiteral) ToString() string

ToString implement ast.BinaryLiteral interface

type MyDecimal

type MyDecimal struct {
	// contains filtered or unexported fields
}

MyDecimal represents a decimal value.

func (*MyDecimal) FromString

func (d *MyDecimal) FromString(str []byte) error

FromString parses decimal from string.

func (*MyDecimal) String

func (d *MyDecimal) String() string

String returns the decimal string representation rounded to resultFrac.

func (*MyDecimal) ToString

func (d *MyDecimal) ToString() (str []byte)

ToString converts decimal to its printable string representation without rounding.

RETURN VALUE

    str       - result string
    errCode   - eDecOK/eDecTruncate/eDecOverflow

type ParamMarkerExpr

type ParamMarkerExpr struct {
	ValueExpr
	Offset    int
	Order     int
	InExecute bool
}

ParamMarkerExpr expression holds a place for another expression. Used in parsing prepare statement.

func (*ParamMarkerExpr) Accept

func (n *ParamMarkerExpr) Accept(v ast.Visitor) (ast.Node, bool)

Accept implements Node Accept interface.

func (*ParamMarkerExpr) Format

func (n *ParamMarkerExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ParamMarkerExpr) Restore

func (n *ParamMarkerExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ParamMarkerExpr) SetOrder

func (n *ParamMarkerExpr) SetOrder(order int)

SetOrder implements the ParamMarkerExpr interface.

type ValueExpr

type ValueExpr struct {
	ast.TexprNode
	Datum
	// contains filtered or unexported fields
}

ValueExpr is the simple value expression.

func (*ValueExpr) Accept

func (n *ValueExpr) Accept(v ast.Visitor) (ast.Node, bool)

Accept implements Node interface.

func (*ValueExpr) Format

func (n *ValueExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ValueExpr) GetDatumString

func (n *ValueExpr) GetDatumString() string

GetDatumString implements the ValueExpr interface.

func (*ValueExpr) GetProjectionOffset

func (n *ValueExpr) GetProjectionOffset() int

GetProjectionOffset returns ValueExpr.projectionOffset.

func (*ValueExpr) Restore

func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ValueExpr) SetProjectionOffset

func (n *ValueExpr) SetProjectionOffset(offset int)

SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder.

Jump to

Keyboard shortcuts

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