Documentation ¶
Index ¶
- Constants
- Variables
- func Abs(n int64) int64
- func DefaultTypeForValue(value interface{}, tp *types.FieldType, charset string, collate string)
- func SetBinChsClnFlag(ft *types.FieldType)
- func StrLenOfInt64Fast(x int64) int
- func StrLenOfUint64Fast(x uint64) int
- type BinaryLiteral
- type BitLiteral
- type Datum
- func (d *Datum) GetBinaryLiteral() BinaryLiteral
- func (d *Datum) GetBytes() []byte
- func (d *Datum) GetFloat32() float32
- func (d *Datum) GetFloat64() float64
- func (d *Datum) GetInt64() int64
- func (d *Datum) GetInterface() interface{}
- func (d *Datum) GetMysqlDecimal() *MyDecimal
- func (d *Datum) GetString() string
- func (d *Datum) GetUint64() uint64
- func (d *Datum) GetValue() interface{}
- func (d *Datum) Kind() byte
- func (d *Datum) SetBinaryLiteral(b BinaryLiteral)
- func (d *Datum) SetBytes(b []byte)
- func (d *Datum) SetBytesAsString(b []byte)
- func (d *Datum) SetFloat32(f float32)
- func (d *Datum) SetFloat64(f float64)
- func (d *Datum) SetInt64(i int64)
- func (d *Datum) SetInterface(x interface{})
- func (d *Datum) SetMysqlDecimal(b *MyDecimal)
- func (d *Datum) SetNull()
- func (d *Datum) SetString(s string)
- func (d *Datum) SetUint64(i uint64)
- func (d *Datum) SetValue(val interface{})
- type HexLiteral
- type MyDecimal
- type ParamMarkerExpr
- type ValueExpr
Constants ¶
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.
Variables ¶
var ZeroBinaryLiteral = BinaryLiteral{}
ZeroBinaryLiteral is a BinaryLiteral literal with zero value.
Functions ¶
func DefaultTypeForValue ¶
DefaultTypeForValue returns the default FieldType for the value.
func SetBinChsClnFlag ¶
SetBinChsClnFlag sets charset, collation as 'binary' and adds binaryFlag to FieldType.
func StrLenOfInt64Fast ¶
StrLenOfInt64Fast efficiently calculate the string character lengths of an int64 as input
func StrLenOfUint64Fast ¶
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 ¶
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 ¶
NewStringDatum creates a new Datum from a string.
func (*Datum) GetBinaryLiteral ¶
func (d *Datum) GetBinaryLiteral() BinaryLiteral
GetBinaryLiteral gets Bit value
func (*Datum) GetInterface ¶
func (d *Datum) GetInterface() interface{}
GetInterface gets interface value.
func (*Datum) GetMysqlDecimal ¶
GetMysqlDecimal gets Decimal value
func (*Datum) GetValue ¶
func (d *Datum) GetValue() interface{}
GetValue gets the value of the datum of any kind.
func (*Datum) SetBinaryLiteral ¶
func (d *Datum) SetBinaryLiteral(b BinaryLiteral)
SetBinaryLiteral sets Bit value
func (*Datum) SetBytesAsString ¶
SetBytesAsString sets bytes value to datum as string type.
func (*Datum) SetInterface ¶
func (d *Datum) SetInterface(x interface{})
SetInterface sets interface to datum.
func (*Datum) SetMysqlDecimal ¶
SetMysqlDecimal sets Decimal 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 ¶
FromString parses decimal from string.
type ParamMarkerExpr ¶
ParamMarkerExpr expression holds a place for another expression. Used in parsing prepare statement.
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 ¶
ValueExpr is the simple value expression.
func (*ValueExpr) GetDatumString ¶
GetDatumString implements the ValueExpr interface.
func (*ValueExpr) GetProjectionOffset ¶
GetProjectionOffset returns ValueExpr.projectionOffset.
func (*ValueExpr) Restore ¶
func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*ValueExpr) SetProjectionOffset ¶
SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder.