Versions in this module Expand all Collapse all v1 v1.0.0 Oct 31, 2024 Changes in this version + const DateFormat + const DefaultFsp + 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 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 ZeroDateStr + 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 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 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(fval float64, lowerBound, upperBound int64, tp byte) (int64, error) + func ConvertFloatToUint(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 *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 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 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, 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 IsTypeFloat(tp byte) bool + func IsTypeFractionable(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 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) (_ 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) + 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 Datum struct + func CoerceDatum(sc *stmtctx.StatementContext, a, b Datum) (x, y 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 *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) 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.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 DatumRow []Datum + func (dr DatumRow) Copy() DatumRow + func (dr DatumRow) GetBytes(colIdx int) []byte + func (dr DatumRow) GetDatum(colIdx int, tp *FieldType) Datum + func (dr DatumRow) GetDuration(colIdx int) Duration + func (dr DatumRow) GetEnum(colIdx int) Enum + func (dr DatumRow) GetFloat32(colIdx int) float32 + func (dr DatumRow) GetFloat64(colIdx int) float64 + func (dr DatumRow) GetInt64(colIdx int) int64 + func (dr DatumRow) GetJSON(colIdx int) json.BinaryJSON + func (dr DatumRow) GetMyDecimal(colIdx int) *MyDecimal + func (dr DatumRow) GetSet(colIdx int) Set + func (dr DatumRow) GetString(colIdx int) string + func (dr DatumRow) GetTime(colIdx int) Time + func (dr DatumRow) GetUint64(colIdx int) uint64 + func (dr DatumRow) IsNull(colIdx int) bool + func (dr DatumRow) Len() int + type Duration struct + Fsp int + func NumberToDuration(number int64, fsp int) (Duration, error) + 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 *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 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) Equal(other *FieldType) bool + func (ft *FieldType) EvalType() EvalType + func (ft *FieldType) FormatAsCastType(w io.Writer) + 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 MyDecimal struct + func ConvertDatumToDecimal(sc *stmtctx.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 *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) 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 Row interface + GetBytes func(colIdx int) []byte + GetDatum func(colIdx int, tp *FieldType) Datum + GetDuration func(colIdx int) Duration + GetEnum func(colIdx int) Enum + GetFloat32 func(colIdx int) float32 + GetFloat64 func(colIdx int) float64 + GetInt64 func(colIdx int) int64 + GetJSON func(colIdx int) json.BinaryJSON + GetMyDecimal func(colIdx int) *MyDecimal + GetSet func(colIdx int) Set + GetString func(colIdx int) string + GetTime func(colIdx int) Time + GetUint64 func(colIdx int) uint64 + IsNull func(colIdx int) bool + Len func() int + 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, fst int) (Time, error) + func ParseTimeFromFloatString(sc *stmtctx.StatementContext, str string, tp byte, fst 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(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) 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)