Versions in this module Expand all Collapse all v1 v1.0.0 May 24, 2019 Changes in this version + const DateFormat + const DefaultFsp + const ETDatetime + const ETDecimal + const ETDuration + const ETInt + const ETJson + const ETReal + const ETString + const ETTimestamp + const KindBinaryLiteral + const KindBytes + const KindFloat32 + const KindFloat64 + const KindInt64 + const KindInterface + const KindMaxValue + const KindMinNotNull + const KindMysqlBit + const KindMysqlDecimal + const KindMysqlDuration + const KindMysqlEnum + const KindMysqlJSON + const KindMysqlSet + const KindMysqlTime + const KindNull + const KindRaw + const KindString + const KindUint64 + const MaxDuration + const MaxFsp + const MaxTime + const MaxYear + const MinFsp + const MinTime + const MinYear + const MyDecimalStructSize + const TimeFSPFormat + const TimeFormat + const TimeMaxHour + const TimeMaxMinute + const TimeMaxSecond + const TimeMaxValue + const TimeMaxValueSeconds + const UnspecifiedFsp + const UnspecifiedLength + const VarStorageLen + const ZeroDateStr + const ZeroDatetimeStr + var BoundTimezone = gotime.UTC + var ErrBadNumber = terror.ClassTypes.New(codeBadNumber, "Bad Number") + var ErrCastAsSignedOverflow = terror.ClassTypes.New(codeUnknown, msgCastAsSignedOverflow) + var ErrCastNegIntAsUnsigned = terror.ClassTypes.New(codeUnknown, msgCastNegIntAsUnsigned) + var ErrDataTooLong = terror.ClassTypes.New(codeDataTooLong, "Data Too Long") + var ErrDivByZero = terror.ClassTypes.New(codeDivByZero, "Division by 0") + var ErrDuplicatedValueInType = terror.ClassTypes.New(codeDuplicatedValueInType, mysql.MySQLErrName[mysql.ErrDuplicatedValueInType]) + var ErrIllegalValueForType = terror.ClassTypes.New(codeIllegalValueForType, mysql.MySQLErrName[mysql.ErrIllegalValueForType]) + var ErrIncorrectDatetimeValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "Incorrect datetime value: '%s'") + var ErrInvalidDefault = parser_types.ErrInvalidDefault + var ErrInvalidTimeFormat = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "invalid time format: '%v'") + var ErrInvalidYear = errors.New("invalid year") + var ErrInvalidYearFormat = errors.New("invalid year format") + var ErrMBiggerThanD = terror.ClassTypes.New(codeMBiggerThanD, mysql.MySQLErrName[mysql.ErrMBiggerThanD]) + var ErrOverflow = terror.ClassTypes.New(codeOverflow, msgOverflow) + var ErrTooBigDisplayWidth = terror.ClassTypes.New(codeTooBigDisplayWidth, "Too Big Display width") + var ErrTooBigFieldLength = terror.ClassTypes.New(codeTooBigFieldLength, "Too Big Field length") + var ErrTooBigPrecision = terror.ClassTypes.New(codeTooBigPrecision, mysql.MySQLErrName[mysql.ErrTooBigPrecision]) + var ErrTooBigScale = terror.ClassTypes.New(codeTooBigScale, mysql.MySQLErrName[mysql.ErrTooBigScale]) + var ErrTooBigSet = terror.ClassTypes.New(codeTooBigSet, "Too Big Set") + var ErrTruncated = terror.ClassTypes.New(codeTruncated, "Data Truncated") + var ErrTruncatedWrongVal = terror.ClassTypes.New(codeTruncatedWrongValue, msgTruncatedWrongVal) + var ErrTruncatedWrongValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue]) + var ErrWarnDataOutOfRange = terror.ClassTypes.New(codeDataOutOfRange, mysql.MySQLErrName[mysql.ErrWarnDataOutOfRange]) + var ErrWrongFieldSpec = terror.ClassTypes.New(codeWrongFieldSpec, "Wrong Field Spec") + var ErrZeroDate = errors.New("datetime zero in date") + var IsTypeBlob = ast.IsTypeBlob + var IsTypeChar = ast.IsTypeChar + var MaxDatetime = FromDate(9999, 12, 31, 23, 59, 59, 999999) + var MaxTimestamp = Time + var MinDatetime = FromDate(1000, 1, 1, 0, 0, 0, 0) + var MinTimestamp = Time + var MonthNames = []string + var SignedLowerBound = map[byte]int64 + var SignedUpperBound = map[byte]int64 + var TypeStr = ast.TypeStr + var TypeToStr = ast.TypeToStr + var UnsignedUpperBound = map[byte]uint64 + var WeekdayNames = []string + var ZeroBinaryLiteral = BinaryLiteral + var ZeroDate = Time + var ZeroDatetime = Time + var ZeroDuration = Duration + var ZeroTime = MysqlTime + var ZeroTimestamp = Time + func AddDate(year, month, day int64, ot gotime.Time) (nt gotime.Time) + func AddInt64(a int64, b int64) (int64, error) + func AddInteger(a uint64, b int64) (uint64, error) + func AddUint64(a uint64, b uint64) (uint64, error) + func AdjustYear(y int64, shouldAdjust bool) (int64, error) + func CheckFsp(fsp int) (int, error) + func CompareFloat64(x, y float64) int + func CompareInt64(x, y int64) int + func CompareString(x, y string) int + func CompareUint64(x, y uint64) int + func ConvertFloatToInt(fval float64, lowerBound, upperBound int64, tp byte) (int64, error) + func ConvertFloatToUint(sc *stmtctx.StatementContext, fval float64, upperBound uint64, tp byte) (uint64, error) + func ConvertIntToInt(val int64, lowerBound int64, upperBound int64, tp byte) (int64, error) + func ConvertIntToUint(sc *stmtctx.StatementContext, val int64, upperBound uint64, tp byte) (uint64, error) + func ConvertJSONToFloat(sc *stmtctx.StatementContext, j json.BinaryJSON) (float64, error) + func ConvertJSONToInt(sc *stmtctx.StatementContext, j json.BinaryJSON, unsigned bool) (int64, error) + func ConvertUintToInt(val uint64, upperBound int64, tp byte) (int64, error) + func ConvertUintToUint(val uint64, upperBound uint64, tp byte) (uint64, error) + func DateDiff(startTime, endTime MysqlTime) int + func DateFSP(date string) (fsp int) + func DatumsToStrNoErr(datums []Datum) string + func DatumsToString(datums []Datum, handleSpecialValue bool) (string, error) + func DecimalAdd(from1, from2, to *MyDecimal) error + func DecimalDiv(from1, from2, to *MyDecimal, fracIncr int) error + func DecimalMod(from1, from2, to *MyDecimal) error + func DecimalMul(from1, from2, to *MyDecimal) error + func DecimalPeak(b []byte) (int, error) + func DecimalSub(from1, from2, to *MyDecimal) error + func DefaultCharsetForType(tp byte) (string, string) + func DefaultParamTypeForValue(value interface{}, tp *FieldType) + func DefaultTypeForValue(value interface{}, tp *FieldType) + func DivInt64(a int64, b int64) (int64, error) + func DivIntWithUint(a int64, b uint64) (uint64, error) + func DivUintWithInt(a uint64, b int64) (uint64, error) + func EOFAsNil(err error) error + func EqualDatums(sc *stmtctx.StatementContext, a []Datum, b []Datum) (bool, error) + func ExtractDatetimeNum(t *Time, unit string) (int64, error) + func ExtractDurationNum(d *Duration, unit string) (int64, error) + func ExtractTimeValue(unit string, format string) (int64, int64, int64, float64, error) + func GetFormatType(format string) (isDuration, isDate bool) + func GetFsp(s string) (fsp int) + func GetLastDay(year, month int) int + func GetMaxFloat(flen int, decimal int) float64 + func InvOp2(x, y interface{}, o opcode.Op) (interface{}, error) + func IsBinaryStr(ft *FieldType) bool + func IsClockUnit(unit string) bool + func IsDateFormat(format string) bool + func IsNonBinaryStr(ft *FieldType) bool + func IsString(tp byte) bool + func IsTemporalWithDate(tp byte) bool + func IsTypeFractionable(tp byte) bool + func IsTypeNumeric(tp byte) bool + func IsTypePrefixable(tp byte) bool + func IsTypeTemporal(tp byte) bool + func IsTypeTime(tp byte) bool + func IsTypeUnspecified(tp byte) bool + func IsTypeVarchar(tp byte) bool + func KindStr(kind byte) (r string) + func MergeFieldType(a byte, b byte) byte + func MulInt64(a int64, b int64) (int64, error) + func MulInteger(a uint64, b int64) (uint64, error) + func MulUint64(a uint64, b uint64) (uint64, error) + func ParseDateFormat(format string) []string + func ParseFrac(s string, fsp int) (v int, overflow bool, err error) + func ParseYear(str string) (int16, error) + func ProduceFloatWithSpecifiedTp(f float64, target *FieldType, sc *stmtctx.StatementContext) (_ float64, err error) + func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *stmtctx.StatementContext, padZero bool) (_ string, err error) + func Round(f float64, dec int) float64 + func RoundFloat(f float64) float64 + func RoundFrac(t gotime.Time, fsp int) (gotime.Time, error) + func SetBinChsClnFlag(ft *FieldType) + func SortDatums(sc *stmtctx.StatementContext, datums []Datum) error + func StrToDuration(sc *stmtctx.StatementContext, str string, fsp int) (d Duration, t Time, isDuration bool, err error) + func StrToFloat(sc *stmtctx.StatementContext, str string) (float64, error) + func StrToInt(sc *stmtctx.StatementContext, str string) (int64, error) + func StrToUint(sc *stmtctx.StatementContext, str string) (uint64, error) + func SubInt64(a int64, b int64) (int64, error) + func SubIntWithUint(a int64, b uint64) (uint64, error) + func SubUint64(a uint64, b uint64) (uint64, error) + func SubUintWithInt(a uint64, b int64) (uint64, error) + func TimestampDiff(unit string, t1 Time, t2 Time) int64 + func ToString(value interface{}) (string, error) + func Truncate(f float64, dec int) float64 + func TruncateFloat(f float64, flen int, decimal int) (float64, error) + func TruncateOverflowMySQLTime(d gotime.Duration) (gotime.Duration, error) + type BinaryLiteral []byte + func NewBinaryLiteralFromUint(value uint64, byteSize int) BinaryLiteral + func ParseBitStr(s string) (BinaryLiteral, error) + func ParseHexStr(s string) (BinaryLiteral, error) + func (b BinaryLiteral) Compare(b2 BinaryLiteral) int + func (b BinaryLiteral) String() string + func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string + func (b BinaryLiteral) ToInt(sc *stmtctx.StatementContext) (uint64, error) + func (b BinaryLiteral) ToString() string + type BitLiteral BinaryLiteral + func NewBitLiteral(s string) (BitLiteral, error) + type Datum struct + func ComputePlus(a, b Datum) (d Datum, err error) + func CopyDatum(datum Datum) Datum + func CopyRow(dr []Datum) []Datum + func MakeDatums(args ...interface{}) []Datum + func MaxValueDatum() Datum + func MinNotNullDatum() Datum + func NewBinaryLiteralDatum(b BinaryLiteral) (d Datum) + func NewBytesDatum(b []byte) (d Datum) + func NewDatum(in interface{}) (d Datum) + func NewDecimalDatum(dec *MyDecimal) (d Datum) + func NewDurationDatum(dur Duration) (d Datum) + func NewFloat32Datum(f float32) (d Datum) + func NewFloat64Datum(f float64) (d Datum) + func NewIntDatum(i int64) (d Datum) + func NewMysqlBitDatum(b BinaryLiteral) (d Datum) + func NewMysqlEnumDatum(e Enum) (d Datum) + func NewStringDatum(s string) (d Datum) + func NewTimeDatum(t Time) (d Datum) + func NewUintDatum(i uint64) (d Datum) + func (d *Datum) Collation() byte + func (d *Datum) CompareDatum(sc *stmtctx.StatementContext, ad *Datum) (int, error) + func (d *Datum) ConvertTo(sc *stmtctx.StatementContext, target *FieldType) (Datum, error) + func (d *Datum) Copy() *Datum + func (d *Datum) Frac() int + 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) GetMysqlBit() BinaryLiteral + func (d *Datum) GetMysqlDecimal() *MyDecimal + func (d *Datum) GetMysqlDuration() Duration + func (d *Datum) GetMysqlEnum() Enum + func (d *Datum) GetMysqlJSON() json.BinaryJSON + func (d *Datum) GetMysqlSet() Set + func (d *Datum) GetMysqlTime() Time + func (d *Datum) GetRaw() []byte + func (d *Datum) GetString() string + func (d *Datum) GetUint64() uint64 + func (d *Datum) GetValue() interface{} + func (d *Datum) IsNull() bool + func (d *Datum) Kind() byte + func (d *Datum) Length() int + func (d *Datum) SetAutoID(id int64, flag uint) + func (d *Datum) SetBinaryLiteral(b BinaryLiteral) + func (d *Datum) SetBytes(b []byte) + func (d *Datum) SetBytesAsString(b []byte) + func (d *Datum) SetCollation(collation byte) + func (d *Datum) SetFloat32(f float32) + func (d *Datum) SetFloat64(f float64) + func (d *Datum) SetFrac(frac int) + func (d *Datum) SetInt64(i int64) + func (d *Datum) SetInterface(x interface{}) + func (d *Datum) SetLength(l int) + func (d *Datum) SetMinNotNull() + func (d *Datum) SetMysqlBit(b BinaryLiteral) + func (d *Datum) SetMysqlDecimal(b *MyDecimal) + func (d *Datum) SetMysqlDuration(b Duration) + func (d *Datum) SetMysqlEnum(b Enum) + func (d *Datum) SetMysqlJSON(b json.BinaryJSON) + func (d *Datum) SetMysqlSet(b Set) + func (d *Datum) SetMysqlTime(b Time) + func (d *Datum) SetNull() + func (d *Datum) SetRaw(b []byte) + func (d *Datum) SetString(s string) + func (d *Datum) SetUint64(i uint64) + func (d *Datum) SetValue(val interface{}) + func (d *Datum) ToBool(sc *stmtctx.StatementContext) (int64, error) + func (d *Datum) ToBytes() ([]byte, error) + func (d *Datum) ToDecimal(sc *stmtctx.StatementContext) (*MyDecimal, error) + func (d *Datum) ToFloat64(sc *stmtctx.StatementContext) (float64, error) + func (d *Datum) ToInt64(sc *stmtctx.StatementContext) (int64, error) + func (d *Datum) ToMysqlJSON() (j json.BinaryJSON, err error) + func (d *Datum) ToString() (string, error) + type Duration struct + Fsp int + func NumberToDuration(number int64, fsp int) (Duration, error) + func ParseDuration(sc *stmtctx.StatementContext, str string, fsp int) (Duration, error) + func (d Duration) Add(v Duration) (Duration, error) + func (d Duration) Compare(o Duration) int + func (d Duration) CompareString(sc *stmtctx.StatementContext, str string) (int, error) + func (d Duration) ConvertToTime(sc *stmtctx.StatementContext, tp uint8) (Time, error) + func (d Duration) Hour() int + func (d Duration) MicroSecond() int + func (d Duration) Minute() int + func (d Duration) RoundFrac(fsp int) (Duration, error) + func (d Duration) Second() int + func (d Duration) String() string + func (d Duration) Sub(v Duration) (Duration, error) + func (d Duration) ToNumber() *MyDecimal + type Enum struct + Name string + Value uint64 + func ParseEnumName(elems []string, name string) (Enum, error) + func ParseEnumValue(elems []string, number uint64) (Enum, error) + func (e Enum) String() string + func (e Enum) ToNumber() float64 + type EvalType = ast.EvalType + func AggregateEvalType(fts []*FieldType, flag *uint) EvalType + type FieldType = ast.FieldType + func AggFieldType(tps []*FieldType) *FieldType + func NewFieldType(tp byte) *FieldType + type HexLiteral BinaryLiteral + func NewHexLiteral(s string) (HexLiteral, error) + type MyDecimal struct + func ConvertDatumToDecimal(sc *stmtctx.StatementContext, d Datum) (*MyDecimal, error) + func ConvertJSONToDecimal(sc *stmtctx.StatementContext, j json.BinaryJSON) (*MyDecimal, error) + func DecimalNeg(from *MyDecimal) *MyDecimal + func NewDecFromFloatForTest(f float64) *MyDecimal + func NewDecFromInt(i int64) *MyDecimal + func NewDecFromStringForTest(s string) *MyDecimal + func NewDecFromUint(i uint64) *MyDecimal + func NewMaxOrMinDec(negative bool, prec, frac int) *MyDecimal + func ProduceDecWithSpecifiedTp(dec *MyDecimal, tp *FieldType, sc *stmtctx.StatementContext) (_ *MyDecimal, err error) + func (d *MyDecimal) Compare(to *MyDecimal) int + func (d *MyDecimal) FromBin(bin []byte, precision, frac int) (binSize int, err error) + func (d *MyDecimal) FromFloat64(f float64) error + func (d *MyDecimal) FromInt(val int64) *MyDecimal + func (d *MyDecimal) FromString(str []byte) error + func (d *MyDecimal) FromUint(val uint64) *MyDecimal + func (d *MyDecimal) GetDigitsFrac() int8 + func (d *MyDecimal) IsNegative() bool + func (d *MyDecimal) IsZero() bool + func (d *MyDecimal) PrecisionAndFrac() (precision, frac int) + func (d *MyDecimal) Round(to *MyDecimal, frac int, roundMode RoundMode) (err error) + func (d *MyDecimal) Shift(shift int) error + func (d *MyDecimal) String() string + func (d *MyDecimal) ToBin(precision, frac int) ([]byte, error) + func (d *MyDecimal) ToFloat64() (float64, error) + func (d *MyDecimal) ToHashKey() ([]byte, error) + func (d *MyDecimal) ToInt() (int64, error) + func (d *MyDecimal) ToString() (str []byte) + func (d *MyDecimal) ToUint() (uint64, error) + type MysqlTime struct + func FromDate(year int, month int, day int, hour int, minute int, second int, ...) MysqlTime + func FromGoTime(t gotime.Time) MysqlTime + func (t MysqlTime) Day() int + func (t MysqlTime) GoTime(loc *gotime.Location) (gotime.Time, error) + func (t MysqlTime) Hour() int + func (t MysqlTime) IsLeapYear() bool + func (t MysqlTime) Microsecond() int + func (t MysqlTime) Minute() int + func (t MysqlTime) Month() int + func (t MysqlTime) Second() int + func (t MysqlTime) Week(mode int) int + func (t MysqlTime) Weekday() gotime.Weekday + func (t MysqlTime) Year() int + func (t MysqlTime) YearDay() int + func (t MysqlTime) YearWeek(mode int) (int, int) + type RoundMode string + const DivFracIncr + const ModeHalfEven + const ModeTruncate + type Set struct + Name string + Value uint64 + func ParseSetName(elems []string, name string) (Set, error) + func ParseSetValue(elems []string, number uint64) (Set, error) + func (e Set) String() string + func (e Set) ToNumber() float64 + type Time struct + Fsp int + Time MysqlTime + Type uint8 + func CurrentTime(tp uint8) Time + func MaxMySQLTime(fsp int) Time + func ParseDate(sc *stmtctx.StatementContext, str string) (Time, error) + func ParseDateFromNum(sc *stmtctx.StatementContext, num int64) (Time, error) + func ParseDatetime(sc *stmtctx.StatementContext, str string) (Time, error) + func ParseDatetimeFromNum(sc *stmtctx.StatementContext, num int64) (Time, error) + func ParseTime(sc *stmtctx.StatementContext, str string, tp byte, fsp int) (Time, error) + func ParseTimeFromFloatString(sc *stmtctx.StatementContext, str string, tp byte, fsp int) (Time, error) + func ParseTimeFromInt64(sc *stmtctx.StatementContext, num int64) (Time, error) + func ParseTimeFromNum(sc *stmtctx.StatementContext, num int64, tp byte, fsp int) (Time, error) + func ParseTimestamp(sc *stmtctx.StatementContext, str string) (Time, error) + func ParseTimestampFromNum(sc *stmtctx.StatementContext, num int64) (Time, error) + func StrToDateTime(sc *stmtctx.StatementContext, str string, fsp int) (Time, error) + func TimeFromDays(num int64) Time + func (t *Time) Add(sc *stmtctx.StatementContext, d Duration) (Time, error) + func (t *Time) Check(sc *stmtctx.StatementContext) error + func (t *Time) ConvertTimeZone(from, to *gotime.Location) error + func (t *Time) FromPackedUint(packed uint64) error + func (t *Time) StrToDate(sc *stmtctx.StatementContext, date, format string) bool + func (t *Time) Sub(sc *stmtctx.StatementContext, t1 *Time) Duration + func (t Time) Clock() (hour int, minute int, second int) + func (t Time) Compare(o Time) int + func (t Time) CompareString(sc *stmtctx.StatementContext, str string) (int, error) + func (t Time) Convert(sc *stmtctx.StatementContext, tp uint8) (Time, error) + func (t Time) ConvertToDuration() (Duration, error) + func (t Time) DateFormat(layout string) (string, error) + func (t Time) InvalidZero() bool + func (t Time) IsZero() bool + func (t Time) RoundFrac(sc *stmtctx.StatementContext, fsp int) (Time, error) + func (t Time) String() string + func (t Time) ToNumber() *MyDecimal + func (t Time) ToPackedUint() (uint64, error)