parser: Index | Files

package test_driver

import ""


Package Files

test_driver.go test_driver_datum.go test_driver_helper.go test_driver_mydecimal.go


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.

const DefaultFsp = int8(0)

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


var ZeroBinaryLiteral = BinaryLiteral{}

ZeroBinaryLiteral is a BinaryLiteral literal with zero value.

func Abs Uses

func Abs(n int64) int64

func DefaultTypeForValue Uses

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

DefaultTypeForValue returns the default FieldType for the value.

func SetBinChsClnFlag Uses

func SetBinChsClnFlag(ft *types.FieldType)

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

func StrLenOfInt64Fast Uses

func StrLenOfInt64Fast(x int64) int

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

func StrLenOfUint64Fast Uses

func StrLenOfUint64Fast(x uint64) int

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

type BinaryLiteral Uses

type BinaryLiteral []byte

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

func ParseBitStr Uses

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

func ParseHexStr Uses

func ParseHexStr(s string) (BinaryLiteral, error)

ParseHexStr parses hexadecimal string literal. See

func (BinaryLiteral) String Uses

func (b BinaryLiteral) String() string

String implements fmt.Stringer interface.

func (BinaryLiteral) ToBitLiteralString Uses

func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string

ToBitLiteralString returns the bit literal representation for the literal.

func (BinaryLiteral) ToString Uses

func (b BinaryLiteral) ToString() string

ToString returns the string representation for the literal.

type BitLiteral Uses

type BitLiteral BinaryLiteral

BitLiteral is the bit literal type.

func NewBitLiteral Uses

func NewBitLiteral(s string) (BitLiteral, error)

NewBitLiteral parses bit string as BitLiteral type.

func (BitLiteral) ToString Uses

func (b BitLiteral) ToString() string

ToString implement ast.BinaryLiteral interface

type Datum Uses

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 Uses

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

MakeDatums creates datum slice from interfaces.

func NewBytesDatum Uses

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

NewBytesDatum creates a new Datum from a byte slice.

func NewDatum Uses

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

NewDatum creates a new Datum from an interface{}.

func NewStringDatum Uses

func NewStringDatum(s string) (d Datum)

NewStringDatum creates a new Datum from a string.

func (*Datum) GetBinaryLiteral Uses

func (d *Datum) GetBinaryLiteral() BinaryLiteral

GetBinaryLiteral gets Bit value

func (*Datum) GetBytes Uses

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

GetBytes gets bytes value.

func (*Datum) GetFloat32 Uses

func (d *Datum) GetFloat32() float32

GetFloat32 gets float32 value.

func (*Datum) GetFloat64 Uses

func (d *Datum) GetFloat64() float64

GetFloat64 gets float64 value.

func (*Datum) GetInt64 Uses

func (d *Datum) GetInt64() int64

GetInt64 gets int64 value.

func (*Datum) GetInterface Uses

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

GetInterface gets interface value.

func (*Datum) GetMysqlDecimal Uses

func (d *Datum) GetMysqlDecimal() *MyDecimal

GetMysqlDecimal gets Decimal value

func (*Datum) GetString Uses

func (d *Datum) GetString() string

GetString gets string value.

func (*Datum) GetUint64 Uses

func (d *Datum) GetUint64() uint64

GetUint64 gets uint64 value.

func (*Datum) GetValue Uses

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

GetValue gets the value of the datum of any kind.

func (*Datum) Kind Uses

func (d *Datum) Kind() byte

Kind gets the kind of the datum.

func (*Datum) SetBinaryLiteral Uses

func (d *Datum) SetBinaryLiteral(b BinaryLiteral)

SetBinaryLiteral sets Bit value

func (*Datum) SetBytes Uses

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

SetBytes sets bytes value to datum.

func (*Datum) SetBytesAsString Uses

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

SetBytesAsString sets bytes value to datum as string type.

func (*Datum) SetFloat32 Uses

func (d *Datum) SetFloat32(f float32)

SetFloat32 sets float32 value.

func (*Datum) SetFloat64 Uses

func (d *Datum) SetFloat64(f float64)

SetFloat64 sets float64 value.

func (*Datum) SetInt64 Uses

func (d *Datum) SetInt64(i int64)

SetInt64 sets int64 value.

func (*Datum) SetInterface Uses

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

SetInterface sets interface to datum.

func (*Datum) SetMysqlDecimal Uses

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

SetMysqlDecimal sets Decimal value

func (*Datum) SetNull Uses

func (d *Datum) SetNull()

SetNull sets datum to nil.

func (*Datum) SetString Uses

func (d *Datum) SetString(s string)

SetString sets string value.

func (*Datum) SetUint64 Uses

func (d *Datum) SetUint64(i uint64)

SetUint64 sets uint64 value.

func (*Datum) SetValue Uses

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

SetValue sets any kind of value.

type HexLiteral Uses

type HexLiteral BinaryLiteral

HexLiteral is the hex literal type.

func NewHexLiteral Uses

func NewHexLiteral(s string) (HexLiteral, error)

NewHexLiteral parses hexadecimal string as HexLiteral type.

func (HexLiteral) ToString Uses

func (b HexLiteral) ToString() string

ToString implement ast.BinaryLiteral interface

type MyDecimal Uses

type MyDecimal struct {
    // contains filtered or unexported fields

MyDecimal represents a decimal value.

func (*MyDecimal) FromString Uses

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

FromString parses decimal from string.

func (*MyDecimal) String Uses

func (d *MyDecimal) String() string

String returns the decimal string representation rounded to resultFrac.

func (*MyDecimal) ToString Uses

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

ToString converts decimal to its printable string representation without rounding.


    str       - result string
    errCode   - eDecOK/eDecTruncate/eDecOverflow

type ParamMarkerExpr Uses

type ParamMarkerExpr struct {
    Offset    int
    Order     int
    InExecute bool

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

func (*ParamMarkerExpr) Accept Uses

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

Accept implements Node Accept interface.

func (*ParamMarkerExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ParamMarkerExpr) Restore Uses

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

Restore implements Node interface.

func (*ParamMarkerExpr) SetOrder Uses

func (n *ParamMarkerExpr) SetOrder(order int)

SetOrder implements the ParamMarkerExpr interface.

type ValueExpr Uses

type ValueExpr struct {
    // contains filtered or unexported fields

ValueExpr is the simple value expression.

func (*ValueExpr) Accept Uses

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

Accept implements Node interface.

func (*ValueExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ValueExpr) GetDatumString Uses

func (n *ValueExpr) GetDatumString() string

GetDatumString implements the ValueExpr interface.

func (*ValueExpr) GetProjectionOffset Uses

func (n *ValueExpr) GetProjectionOffset() int

GetProjectionOffset returns ValueExpr.projectionOffset.

func (*ValueExpr) Restore Uses

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

Restore implements Node interface.

func (*ValueExpr) SetProjectionOffset Uses

func (n *ValueExpr) SetProjectionOffset(offset int)

SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder.

Package test_driver imports 13 packages (graph). Updated 2020-04-17. Refresh now. Tools for package owners.