package
0.0.0-20241212002435-a4aaf8ca5232
Repository: https://github.com/chrislusf/gleam.git
Documentation: pkg.go.dev

# Functions

AddInt64 adds int64 a and b if no overflow, otherwise returns error.
AddInteger adds uint64 a and int64 b and returns uint64 if no overflow error.
AddUint64 adds uint64 a and b if no overflow, else returns error.
AdjustYear is used for adjusting year and checking its validation.
CoerceArithmetic converts datum to appropriate datum for arithmetic computing.
CoerceDatum changes type.
CompareFloat64 returns an integer comparing the float64 x to y.
CompareInt64 returns an integer comparing the int64 x to y.
CompareString returns an integer comparing the string x to y.
CompareUint64 returns an integer comparing the uint64 x to y.
ComputeBitAnd computes the result of a & b.
ComputeBitNeg computes the result of ~a.
ComputeBitOr computes the result of a | b.
ComputeBitXor computes the result of a ^ b.
ComputeDiv computes the result of a/b.
ComputeIntDiv computes the result of a / b, both a and b are integer.
ComputeLeftShift computes the result of a >> b.
ComputeMinus computes the result of a-b.
ComputeMod computes the result of a mod b.
ComputeMul computes the result of a*b.
ComputePlus computes the result of a+b.
ComputeRightShift computes the result of a << b.
ConvertDatumToDecimal converts datum to decimal.
CurrentTime returns current time with type tp.
DateDiff calculates number of days between two days.
DatumsToInterfaces converts a datum slice to interface slice.
DecimalAdd adds two decimals, sets the result to 'to'.
DecimalDiv does division of two decimals.
DecimalMod does modulus of two decimals.
DecimalMul multiplies two decimals.
DecimalPeak returns the length of the encoded decimal.
DecimalSub subs one decimal from another, sets the result to 'to'.
DefaultCharsetForType returns the default charset/collation for mysql type.
DefaultTypeForValue returns the default FieldType for the value.
DivInt64 divides int64 a with b, returns int64 if no overflow error.
DivIntWithUint divides int64 a with uint64 b, returns uint64 if no overflow error.
DivUintWithInt divides uint64 a with int64 b, returns uint64 if no overflow error.
EOFAsNil filtrates errors, If err is equal to io.EOF returns nil.
EqualDatums compare if a and b contains the same datum values.
ExtractTimeNum extracts time value number from time unit and format.
ExtractTimeValue extracts time value from time unit and format.
FromDate makes a internal time representation from the given date.
FromGoTime translates time.Time to mysql time internal representation.
InvOp2 returns an invalid operation error.
IsClockUnit returns true when unit is interval unit with hour, minute or second.
IsDateFormat returns true when the specified time format could contain only date.
IsTypeBlob returns a boolean indicating whether the tp is a blob type.
IsTypeChar returns a boolean indicating whether the tp is the char type like a string type or a varchar type.
IsTypeFractionable returns a boolean indicating whether the tp can has time fraction.
IsTypePrefixable returns a boolean indicating whether an index on a column with the tp can be defined with a prefix.
MakeDatums creates datum slice from interfaces.
MaxValueDatum returns a datum represents max value.
MergeFieldType merges two MySQL type to a new type.
MinNotNullDatum returns a datum represents minimum not null value.
MulInt64 multiplies int64 a and b and returns int64 if no overflow error.
MulInteger multiplies uint64 a and int64 b, and returns uint64 if no overflow error.
MulUint64 multiplies uint64 a and b and returns uint64 if no overflow error.
NewBytesDatum creates a new Datum from a byte slice.
NewDatum creates a new Datum from an interface{}.
NewDecFromFloatForTest creates a MyDecimal from float, as it returns no error, it should only be used in test.
NewDecFromInt creates a MyDecimal from int.
NewDecFromStringForTest creates a MyDecimal from string, as it returns no error, it should only be used in test.
NewDecimalDatum creates a new Datum form a MyDecimal value.
NewDurationDatum creates a new Datum from a Duration value.
NewFieldType returns a FieldType, with a type and other information about field type.
NewFloat32Datum creates a new Datum from a float32 value.
NewFloat64Datum creates a new Datum from a float64 value.
NewIntDatum creates a new Datum from an int64 value.
NewMaxOrMinDec returns the max or min value decimal for given precision and fraction.
NewStringDatum creates a new Datum from a string.
NewUintDatum creates a new Datum from an uint64 value.
ParseBit parses bit string.
ParseDate is a helper function wrapping ParseTime with date type.
ParseDateFromNum is a helper function wrapping ParseTimeFromNum with date type.
ParseDatetime is a helper function wrapping ParseTime with datetime type and default fsp.
ParseDatetimeFromNum is a helper function wrapping ParseTimeFromNum with datetime type and default fsp.
ParseDuration parses the time form a formatted string with a fractional seconds part, returns the duration type Time value.
ParseEnumName creates a Enum with item name.
ParseEnumValue creates a Enum with special number.
ParseHex parses hexadecimal literal string.
ParseHexStr parses hexadecimal literal as string.
ParseSetName creates a Set with name.
ParseSetValue creates a Set with special number.
ParseTime parses a formatted string with type tp and specific fsp.
ParseTimeFromInt64 parses mysql time value from int64.
ParseTimeFromNum parses a formatted int64, returns the value which type is tp.
ParseTimestamp is a helper function wrapping ParseTime with timestamp type and default fsp.
ParseTimestampFromNum is a helper function wrapping ParseTimeFromNum with timestamp type and default fsp.
ParseYear parses a formatted string and returns a year number.
Round rounds the argument f to dec decimal places.
RoundFloat rounds float val to the nearest integer value with float64 format, like MySQL Round function.
RoundFrac rounds fractional seconds precision with new fsp and returns a new one.
SortDatums sorts a slice of datum.
StrToFloat converts a string to a float64 at the best-effort.
StrToInt converts a string to an integer at the best-effort.
StrToUint converts a string to an unsigned interger at the best-effortt.
SubInt64 subtracts int64 a with b and returns int64 if no overflow error.
SubIntWithUint subtracts int64 a with uint64 b and returns uint64 if no overflow error.
SubUint64 subtracts uint64 a with b and returns uint64 if no overflow error.
SubUintWithInt subtracts uint64 a with int64 b and returns uint64 if no overflow error.
TimeFromDays Converts a day number to a date.
TimestampDiff returns t2 - t1 where t1 and t2 are date or datetime expressions.
ToString converts an interface to a string.
TruncateFloat tries to truncate f.
TypeStr converts tp to a string.
TypeToStr converts a field to a string.

# Constants

Time format without fractional seconds precision.
DefaultFsp is the default digit of fractional seconds part.
constant values.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Kind constants.
Min and Max bit width.
constant values.
MaxFsp is the maximum digit of fractional seconds part.
MaxTime is the maximum for mysql time type.
MaxYear is the maximum for mysql year type.
Min and Max bit width.
MinFsp is the minimum digit of fractional seconds part.
MinTime is the minimum for mysql time type.
MinYear is the minimum for mysql year type.
Time format without fractional seconds precision.
TimeFSPFormat is time format with fractional seconds precision.
UnspecifiedBitWidth is the unspecified with if you want to calculate bit width dynamically.
UnspecifiedFsp is the unspecified fractional seconds part.
UnspecifiedLength is unspecified length.

# Variables

ErrArithOverflow is the error for arthimetic operation overflow.
ErrBadNumber is return when parsing an invalid binary decimal number.
ErrDataTooLong is returned when converts a string value that is longer than field type length.
ErrDivByZero is return when do division by 0.
Portable analogs of some common call errors.
Portable analogs of some common call errors.
Portable analogs of some common call errors.
ErrOverflow is returned when data is out of range for a field type.
ErrTruncated is returned when data has been truncated during convertion.
MonthNames lists names of months, which are used in builtin time function `monthname`.
WeekdayNames lists names of weekdays, which are used in builtin time function `dayname`.
ZeroDate is the zero value for date Time.
ZeroDatetime is the zero value for datetime Time.
ZeroDuration is the zero value for Duration type.
ZeroTime is the zero value for TimeInternal type.
ZeroTimestamp is the zero value for timestamp Time.

# Structs

Bit is for mysql bit type.
Datum is a data box holds different kind of data.
Duration is the type for MySQL time type.
Enum is for MySQL enum type.
FieldType records field type information.
Hex is for mysql hexadecimal literal type.
MyDecimal represents a decimal value.
Set is for MySQL Set type.
Time is the struct for handling datetime, timestamp and date.

# Interfaces

TimeInternal is the internal representation for mysql time in TiDB.