Versions in this module Expand all Collapse all v1 v1.1.0-alpha Oct 31, 2017 v1.0.9 Apr 20, 2018 v1.0.8 Feb 11, 2018 v1.0.7 Jan 19, 2018 v1.0.6 Jan 8, 2018 v1.0.5 Dec 26, 2017 v1.0.4 Dec 11, 2017 v1.0.3 Nov 25, 2017 v1.0.2 Nov 13, 2017 v1.0.1 Oct 31, 2017 v1.0.0 Oct 16, 2017 Changes in this version + const DateFormat + const DefaultFsp + const DivFracIncr + 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 MaxFraction + const MaxFsp + const MaxTime + const MaxYear + const MinFsp + const MinTime + const MinYear + const ModeHalfEven + const ModeTruncate + const TimeFSPFormat + const TimeFormat + const TimeMaxHour + const TimeMaxMinute + const TimeMaxSecond + const TimeMaxValue + const TimeMaxValueSeconds + const UnspecifiedFsp + const UnspecifiedLength + const ZeroDatetimeStr + 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 ErrIllegalValueForType = terror.ClassTypes.New(codeIllegalValueForType, mysql.MySQLErrName[mysql.ErrIllegalValueForType]) + var ErrIncorrectDatetimeValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "Incorrect datetime value: '%s'") + var ErrInvalidDefault = terror.ClassTypes.New(codeInvalidDefault, "Invalid default value for '%s'") + var ErrInvalidTimeFormat = errors.New("invalid time format") + 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 ErrTooBigSet = terror.ClassTypes.New(codeTooBigSet, "Too Big Set") + var ErrTruncated = terror.ClassTypes.New(codeTruncated, "Data Truncated") + var ErrTruncatedWrongVal = terror.ClassTypes.New(codeTruncatedWrongValue, msgTruncatedWrongVal) + var ErrWrongFieldSpec = terror.ClassTypes.New(codeWrongFieldSpec, "Wrong Field Spec") + var ErrZeroDate = errors.New("datetime zero in date") + var MaxDatetime = FromDate(9999, 12, 31, 23, 59, 59, 999999) + var MinDatetime = FromDate(1000, 1, 1, 0, 0, 0, 0) + var MinTimestamp = FromDate(1970, 1, 1, 0, 0, 1, 0) + var MonthNames = []string + var SignedLowerBound = map[byte]int64 + var SignedUpperBound = map[byte]int64 + 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 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) (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(sc *variable.StatementContext, fval float64, lowerBound, upperBound int64, ...) (int64, error) + func ConvertFloatToUint(sc *variable.StatementContext, fval float64, upperBound uint64, tp byte) (uint64, error) + func ConvertIntToInt(val int64, lowerBound int64, upperBound int64, tp byte) (int64, error) + func ConvertIntToUint(val int64, upperBound uint64, tp byte) (uint64, error) + func ConvertJSONToFloat(sc *variable.StatementContext, j json.JSON) (float64, error) + func ConvertJSONToInt(sc *variable.StatementContext, j json.JSON, 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 TimeInternal) int + func DateFSP(date string) (fsp int) + func DatumsToString(datums []Datum) (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 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 *variable.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, gotime.Duration, error) + func GetFormatType(format string) (isDuration, isDate bool) + 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 IsTemporalWithDate(tp byte) bool + func IsTypeBlob(tp byte) bool + func IsTypeChar(tp byte) bool + func IsTypeFractionable(tp byte) bool + func IsTypeJSON(tp byte) bool + func IsTypePrefixable(tp byte) bool + func IsTypeTemporal(tp byte) bool + func IsTypeTime(tp byte) bool + func IsTypeVarchar(tp byte) bool + 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 ParseYear(str string) (int16, error) + func ProduceFloatWithSpecifiedTp(f float64, target *FieldType, sc *variable.StatementContext) (_ float64, err error) + func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *variable.StatementContext) (_ 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 *variable.StatementContext, datums []Datum) error + func StrToDuration(sc *variable.StatementContext, str string, fsp int) (d Duration, t Time, isDuration bool, err error) + func StrToFloat(sc *variable.StatementContext, str string) (float64, error) + func StrToInt(sc *variable.StatementContext, str string) (int64, error) + func StrToUint(sc *variable.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) + func TypeStr(tp byte) (r string) + func TypeToStr(tp byte, cs string) (r string) + 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) String() string + func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string + func (b BinaryLiteral) ToInt() (uint64, error) + func (b BinaryLiteral) ToString() string + type BitLiteral BinaryLiteral + func NewBitLiteral(s string) (BitLiteral, error) + type ColumnRange struct + High Datum + HighExcl bool + Low Datum + LowExcl bool + func (cr *ColumnRange) Convert2ColumnRange() *ColumnRange + func (cr *ColumnRange) Convert2IndexRange() *IndexRange + func (cr *ColumnRange) Convert2IntRange() IntColumnRange + func (cr *ColumnRange) String() string + type Datum struct + func CoerceArithmetic(sc *variable.StatementContext, a Datum) (d Datum, err error) + func CoerceDatum(sc *variable.StatementContext, a, b Datum) (x, y Datum, err error) + func ComputeBitAnd(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeBitNeg(sc *variable.StatementContext, a Datum) (d Datum, err error) + func ComputeBitOr(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeBitXor(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeDiv(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeIntDiv(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeLeftShift(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeMinus(a, b Datum) (d Datum, err error) + func ComputeMod(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func ComputeMul(a, b Datum) (d Datum, err error) + func ComputePlus(a, b Datum) (d Datum, err error) + func ComputeRightShift(sc *variable.StatementContext, a, b Datum) (d Datum, err error) + func CopyDatum(datum 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 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 *variable.StatementContext, ad *Datum) (int, error) + func (d *Datum) ConvertTo(sc *variable.StatementContext, target *FieldType) (Datum, error) + 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.JSON + 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) 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) 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.JSON) + 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 *variable.StatementContext) (int64, error) + func (d *Datum) ToBytes() ([]byte, error) + func (d *Datum) ToDecimal(sc *variable.StatementContext) (*MyDecimal, error) + func (d *Datum) ToFloat64(sc *variable.StatementContext) (float64, error) + func (d *Datum) ToInt64(sc *variable.StatementContext) (int64, error) + func (d *Datum) ToMysqlJSON() (j json.JSON, err error) + func (d *Datum) ToString() (string, error) + type Duration struct + Fsp int + func ParseDuration(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 *variable.StatementContext, str string) (int, error) + func (d Duration) ConvertToTime(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 byte + const ETDatetime + const ETDecimal + const ETDuration + const ETInt + const ETJson + const ETReal + const ETString + const ETTimestamp + func AggregateEvalType(fts []*FieldType, flag *uint) EvalType + func (et EvalType) IsStringKind() bool + type FieldType struct + Charset string + Collate string + Decimal int + Elems []string + Flag uint + Flen int + Tp byte + func AggFieldType(tps []*FieldType) *FieldType + func NewFieldType(tp byte) *FieldType + func (ft *FieldType) CompactStr() string + func (ft *FieldType) EvalType() EvalType + func (ft *FieldType) Hybrid() bool + func (ft *FieldType) InfoSchemaStr() string + func (ft *FieldType) Init(tp byte) + func (ft *FieldType) String() string + type HexLiteral BinaryLiteral + func NewHexLiteral(s string) (HexLiteral, error) + type IndexRange struct + HighExclude bool + HighVal []Datum + LowExclude bool + LowVal []Datum + func (ir *IndexRange) Align(numColumns int) + func (ir *IndexRange) Clone() *IndexRange + func (ir *IndexRange) Convert2ColumnRange() *ColumnRange + func (ir *IndexRange) Convert2IndexRange() *IndexRange + func (ir *IndexRange) Convert2IntRange() IntColumnRange + func (ir *IndexRange) IsPoint(sc *variable.StatementContext) bool + func (ir *IndexRange) PrefixEqualLen(sc *variable.StatementContext) (int, error) + func (ir *IndexRange) String() string + type IntColumnRange struct + HighVal int64 + LowVal int64 + func (tr *IntColumnRange) IsPoint() bool + func (tr IntColumnRange) Convert2ColumnRange() *ColumnRange + func (tr IntColumnRange) Convert2IndexRange() *IndexRange + func (tr IntColumnRange) Convert2IntRange() IntColumnRange + func (tr IntColumnRange) String() string + type MyDecimal struct + func ConvertDatumToDecimal(sc *variable.StatementContext, d Datum) (*MyDecimal, error) + 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 *variable.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) ToInt() (int64, error) + func (d *MyDecimal) ToString() (str []byte) + func (d *MyDecimal) ToUint() (uint64, error) + type Range interface + Convert2ColumnRange func() *ColumnRange + Convert2IndexRange func() *IndexRange + Convert2IntRange func() IntColumnRange + type RoundMode string + 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 TimeInternal + TimeZone *gotime.Location + Type uint8 + func CurrentTime(tp uint8) Time + func MaxMySQLTime(neg bool, fsp int) Time + func NumberToDuration(number int64, fsp int) (t Time, err error) + func ParseDate(sc *variable.StatementContext, str string) (Time, error) + func ParseDateFromNum(sc *variable.StatementContext, num int64) (Time, error) + func ParseDatetime(sc *variable.StatementContext, str string) (Time, error) + func ParseDatetimeFromNum(sc *variable.StatementContext, num int64) (Time, error) + func ParseTime(sc *variable.StatementContext, str string, tp byte, fst int) (Time, error) + func ParseTimeFromFloatString(sc *variable.StatementContext, str string, tp byte, fst int) (Time, error) + func ParseTimeFromInt64(sc *variable.StatementContext, num int64) (Time, error) + func ParseTimeFromNum(sc *variable.StatementContext, num int64, tp byte, fsp int) (Time, error) + func ParseTimestamp(sc *variable.StatementContext, str string) (Time, error) + func ParseTimestampFromNum(sc *variable.StatementContext, num int64) (Time, error) + func StrToDateTime(sc *variable.StatementContext, str string, fsp int) (Time, error) + func TimeFromDays(num int64) Time + func (t *Time) Add(d Duration) (Time, error) + func (t *Time) Check() error + func (t *Time) ConvertTimeZone(from, to *gotime.Location) error + func (t *Time) FromPackedUint(packed uint64) error + func (t *Time) IsNegative() bool + func (t *Time) StrToDate(sc *variable.StatementContext, date, format string) bool + func (t *Time) Sub(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 *variable.StatementContext, str string) (int, error) + func (t Time) Convert(sc *variable.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(fsp int) (Time, error) + func (t Time) String() string + func (t Time) ToNumber() *MyDecimal + func (t Time) ToPackedUint() (uint64, error) + type TimeInternal interface + Day func() int + GoTime func(*gotime.Location) (gotime.Time, error) + Hour func() int + IsLeapYear func() bool + Microsecond func() int + Minute func() int + Month func() int + Second func() int + Week func(mode int) int + Weekday func() gotime.Weekday + Year func() int + YearDay func() int + YearWeek func(mode int) (int, int) + func FromDate(year int, month int, day int, hour int, minute int, second int, ...) TimeInternal + func FromGoTime(t gotime.Time) TimeInternal