types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VarlenaInlineSize = 23
	VarlenaSize       = 24
	MaxStringSize     = 10485760
	VarlenaBigHdr     = 0xffffffff
	MaxVarcharLen     = 65535
	MaxCharLen        = 255
	MaxBinaryLen      = 255
	MaxVarBinaryLen   = 65535
	MaxEnumLen        = 65535
)
View Source
const (
	MaxDateYear    = 9999
	MinDateYear    = 1
	MaxMonthInYear = 12
	MinMonthInYear = 1
)
View Source
const (
	DateType      = 0
	DateTimeType  = 1
	TimeStampType = 2
)
View Source
const (
	// WeekMondayFirst: set Monday as first day of week; otherwise Sunday is first day of week
	WeekMondayFirst WeekBehaviour = 1

	// WeekYear: If set, Week is in range 1-53, otherwise Week is in range 0-53.
	//	Week 0 is returned for the the last week of the previous year (for
	// a date at start of january) In this case one can get 53 for the
	// first week of next year.  This flag ensures that the week is
	// relevant for the given year. Note that this flag is only
	// releveant if WEEK_JANUARY is not set.
	WeekYear = 2

	//WeekFirstWeekday: If not set, Weeks are numbered according to ISO 8601:1988.
	// If set, the week that contains the first 'first-day-of-week' is week 1.
	// ISO 8601:1988 means that if the week containing January 1 has
	// four or more days in the new year, then it is week 1;
	// Otherwise it is the last week of the previous year, and the next week is week 1.
	WeekFirstWeekday = 4
)
View Source
const (
	NanoSecsPerSec = 1000000000 // 10^9

	MillisecsPerSec = 1000 // 10^3

	MaxDatetimeYear = 9999
	MinDatetimeYear = 1
)
View Source
const (
	TSize          int = int(unsafe.Sizeof(Type{}))
	DateSize       int = 4
	TimeSize       int = 8
	DatetimeSize   int = 8
	TimestampSize  int = 8
	Decimal64Size  int = 8
	Decimal128Size int = 16
	UuidSize       int = 16
)
View Source
const (
	// Time range is [-2562047787:59:59.999999,2562047787:59:59.999999]
	// This is the max hour that int64 with solution msec can present
	// (9223372036854775807(max int64)/1000000(msec) - 1)/3600(sec per hour) - 1 = 2562047787
	MinHourInTime, MaxHourInTime     = 0, 2562047787
	MinInputIntTime, MaxInputIntTime = -25620477875959, 25620477875959
)
View Source
const (
	TxnTsSize   = 12
	RowidSize   = 24
	BlockidSize = 20
)
View Source
const IntervalNumMAX = int64(^uint64(0) >> 21)
View Source
const ObjectBytesSize = 18
View Source
const PackerMemUnit = 64
View Source
const (
	// ZeroDatetime is the zero value for date Time '0000-01-01 00:00:00'.
	ZeroDatetime = Datetime(0)
)

Variables

View Source
var DecodeTuple = decodeTuple
View Source
var (
	FillString = []string{"", "0", "00", "000", "0000", "00000", "000000", "0000000"}
)
View Source
var FloatHigh = float64(1<<63) * 2
View Source
var OneSecInMicroSeconds = uint32(1000000)
View Source
var Pow10 = [20]uint64{
	1,
	10,
	100,
	1000,
	10000,
	100000,
	1000000,
	10000000,
	100000000,
	1000000000,
	10000000000,
	100000000000,
	1000000000000,
	10000000000000,
	100000000000000,
	1000000000000000,
	10000000000000000,
	100000000000000000,
	1000000000000000000,
	10000000000000000000,
}
View Source
var Types map[string]T = map[string]T{
	"bool": T_bool,

	"tinyint":  T_int8,
	"smallint": T_int16,
	"int":      T_int32,
	"integer":  T_int32,
	"bigint":   T_int64,

	"tinyint unsigned":  T_uint8,
	"smallint unsigned": T_uint16,
	"int unsigned":      T_uint32,
	"integer unsigned":  T_uint32,
	"bigint unsigned":   T_uint64,

	"decimal64":  T_decimal64,
	"decimal128": T_decimal128,
	"decimal256": T_decimal256,

	"float":  T_float32,
	"double": T_float64,

	"date":      T_date,
	"datetime":  T_datetime,
	"time":      T_time,
	"timestamp": T_timestamp,
	"interval":  T_interval,

	"char":    T_char,
	"varchar": T_varchar,

	"binary":    T_binary,
	"varbinary": T_varbinary,

	"enum": T_enum,

	"json": T_json,
	"text": T_text,
	"blob": T_blob,
	"uuid": T_uuid,

	"transaction timestamp": T_TS,
	"rowid":                 T_Rowid,
	"blockid":               T_Blockid,
}

Functions

func AppendBoolToByteArray added in v0.5.0

func AppendBoolToByteArray(b bool, arr []byte) []byte

func BitAnd added in v0.8.0

func BitAnd(result, v1, v2 []byte)

func BitOr added in v0.8.0

func BitOr(result, v1, v2 []byte)

func BitXor added in v0.8.0

func BitXor(result, v1, v2 []byte)

func BoolToIntString added in v0.6.0

func BoolToIntString(b bool) string

ToIntString print out 1 or 0 as true/false.

func CharsetType added in v0.6.0

func CharsetType(oid T) uint8

func CompareBlockidBlockidAligned added in v0.8.0

func CompareBlockidBlockidAligned(a, b Blockid) int

func CompareDecimal128 added in v0.6.0

func CompareDecimal128(x Decimal128, y Decimal128) int

func CompareDecimal128WithScale added in v0.8.0

func CompareDecimal128WithScale(x, y Decimal128, scale1, scale2 int32) int

func CompareDecimal256 added in v0.8.0

func CompareDecimal256(x Decimal256, y Decimal256) int

func CompareDecimal64 added in v0.6.0

func CompareDecimal64(x Decimal64, y Decimal64) int

func CompareDecimal64WithScale added in v0.8.0

func CompareDecimal64WithScale(x, y Decimal64, scale1, scale2 int32) int

func CompareRowidRowidAligned added in v0.6.0

func CompareRowidRowidAligned(a, b Rowid) int

func CompareTSTSAligned added in v0.6.0

func CompareTSTSAligned(a, b TS) int

func CompareUuid added in v0.6.0

func CompareUuid(left Uuid, right Uuid) int

func Decimal128ToFloat64 added in v0.8.0

func Decimal128ToFloat64(x Decimal128, scale int32) float64

func Decimal64ToFloat64 added in v0.8.0

func Decimal64ToFloat64(x Decimal64, scale int32) float64

func Decode added in v0.6.0

func Decode(data []byte, v encoding.BinaryUnmarshaler) error

func DecodeBool added in v0.6.0

func DecodeBool(v []byte) bool

func DecodeFixed added in v0.6.0

func DecodeFixed[T FixedSizeT](v []byte) T

func DecodeFloat32 added in v0.6.0

func DecodeFloat32(v []byte) float32

func DecodeFloat64 added in v0.6.0

func DecodeFloat64(v []byte) float64

func DecodeInt16 added in v0.6.0

func DecodeInt16(v []byte) int16

func DecodeInt32 added in v0.6.0

func DecodeInt32(v []byte) int32

func DecodeInt64 added in v0.6.0

func DecodeInt64(v []byte) int64

func DecodeInt8 added in v0.6.0

func DecodeInt8(v []byte) int8

func DecodeJson added in v0.6.0

func DecodeJson(buf []byte) bytejson.ByteJson

func DecodeSlice added in v0.6.0

func DecodeSlice[T any](v []byte) []T

func DecodeStringSlice added in v0.6.0

func DecodeStringSlice(data []byte) []string

func DecodeUint16 added in v0.6.0

func DecodeUint16(v []byte) uint16

func DecodeUint32 added in v0.6.0

func DecodeUint32(v []byte) uint32

func DecodeUint64 added in v0.6.0

func DecodeUint64(v []byte) uint64

func DecodeUint8 added in v0.6.0

func DecodeUint8(v []byte) uint8

func DecodeValue added in v0.6.0

func DecodeValue(val []byte, t T) any

func DefaultVal added in v0.6.0

func DefaultVal[T any]() T

var v T

func Encode added in v0.6.0

func Encode(v encoding.BinaryMarshaler) ([]byte, error)

func EncodeBool added in v0.6.0

func EncodeBool(v *bool) []byte

func EncodeDate added in v0.6.0

func EncodeDate(v *Date) []byte

func EncodeDatetime added in v0.6.0

func EncodeDatetime(v *Datetime) []byte

func EncodeDecimal128 added in v0.6.0

func EncodeDecimal128(v *Decimal128) []byte

func EncodeDecimal64 added in v0.6.0

func EncodeDecimal64(v *Decimal64) []byte

func EncodeEnum added in v1.0.0

func EncodeEnum(v *Enum) []byte

func EncodeFixed added in v0.6.0

func EncodeFixed[T FixedSizeT](v T) []byte

func EncodeFloat32 added in v0.6.0

func EncodeFloat32(v *float32) []byte

func EncodeFloat64 added in v0.6.0

func EncodeFloat64(v *float64) []byte

func EncodeInt16 added in v0.6.0

func EncodeInt16(v *int16) []byte

func EncodeInt32 added in v0.6.0

func EncodeInt32(v *int32) []byte

func EncodeInt64 added in v0.6.0

func EncodeInt64(v *int64) []byte

func EncodeInt8 added in v0.6.0

func EncodeInt8(v *int8) []byte

func EncodeJson added in v0.6.0

func EncodeJson(v bytejson.ByteJson) ([]byte, error)

func EncodeSlice added in v0.6.0

func EncodeSlice[T any](v []T) []byte

func EncodeSliceWithCap added in v0.6.0

func EncodeSliceWithCap[T any](v []T) []byte

func EncodeStringSlice added in v0.6.0

func EncodeStringSlice(vs []string) []byte

func EncodeTime added in v0.6.0

func EncodeTime(v *Time) []byte

func EncodeTimestamp added in v0.6.0

func EncodeTimestamp(v *Timestamp) []byte

func EncodeType added in v0.6.0

func EncodeType(v *Type) []byte

func EncodeUint16 added in v0.6.0

func EncodeUint16(v *uint16) []byte

func EncodeUint32 added in v0.6.0

func EncodeUint32(v *uint32) []byte

func EncodeUint64 added in v0.6.0

func EncodeUint64(v *uint64) []byte

func EncodeUint8 added in v0.6.0

func EncodeUint8(v *uint8) []byte

func EncodeUuid added in v0.6.0

func EncodeUuid(v *Uuid) []byte

func EncodeValue added in v0.6.0

func EncodeValue(val any, t T) []byte

func EqualUuid added in v0.6.0

func EqualUuid(src Uuid, dest Uuid) bool

func GetUnixEpochSecs added in v0.7.0

func GetUnixEpochSecs() int64

func Int32ToUint32 added in v0.8.0

func Int32ToUint32(x int32) uint32

func JudgeIntervalNumOverflow added in v0.5.0

func JudgeIntervalNumOverflow(num int64, it IntervalType) error

func LastDay added in v0.5.0

func LastDay(year int32, month uint8) uint8

func NewProtoType added in v0.6.0

func NewProtoType(oid T) *plan.Type

func ParseBool added in v0.5.0

func ParseBool(s string) (bool, error)

func ParseEnum added in v1.0.0

func ParseEnum(enumStr string, name string) (uint16, error)

ParseEnum return item index with item name or value.

func ParseEnumIndex added in v1.0.0

func ParseEnumIndex(enumStr string, index uint16) (string, error)

ParseEnumIndex return item value with index.

func ParseEnumName added in v1.0.0

func ParseEnumName(enumStr string, name string) (uint16, error)

ParseEnumName return item index with item name.

func ParseEnumValue added in v1.0.0

func ParseEnumValue(enumStr string, number uint16) (uint16, error)

ParseEnumValue return item index with special number.

func ParseSliceToByteJson added in v0.6.0

func ParseSliceToByteJson(dt []byte) (bytejson.ByteJson, error)

func ParseStringToByteJson added in v0.6.0

func ParseStringToByteJson(str string) (bytejson.ByteJson, error)

func ParseStringToPath added in v0.6.0

func ParseStringToPath(str string) (bytejson.Path, error)

func ParseValueToBool added in v0.5.0

func ParseValueToBool(num *tree.NumVal) (bool, error)

func TypeSize added in v0.5.0

func TypeSize(oid T) int

func Uint32ToInt32 added in v0.8.0

func Uint32ToInt32(ux uint32) int32

func UnitIsDayOrLarger added in v0.5.0

func UnitIsDayOrLarger(it IntervalType) bool

UnitIsDayOrLarger if interval type unit is day or larger, we return true else return false use to judge a string whether it needs to become date/datetime type when we use date_add/sub(str string, interval type)

func UuidToString added in v0.6.0

func UuidToString(muuid Uuid) (string, error)

func ValidDate added in v0.6.0

func ValidDate(year int32, month, day uint8) bool

date[0001-01-01 to 9999-12-31]

func ValidDatetime added in v0.6.0

func ValidDatetime(year int32, month, day uint8) bool

date[0001-01-01 00:00:00 to 9999-12-31 23:59:59]

func ValidTime added in v0.6.0

func ValidTime(h, m, s uint64) bool

func ValidTimeInDay added in v0.6.0

func ValidTimeInDay(h, m, s uint8) bool

validTimeInDay return true if hour, minute and second can be a time during a day

func ValidTimestamp added in v0.5.0

func ValidTimestamp(timestamp Timestamp) bool

func WriteValues added in v0.6.0

func WriteValues(w io.Writer, vals ...any) (n int64, err error)

Types

type Blockid added in v0.8.0

type Blockid [BlockidSize]byte

Blockid

func BuildTestBlockid added in v0.8.0

func BuildTestBlockid(a, b int64) (ret Blockid)

BuildTestBlockid used only in unit test

func (Blockid) Compare added in v0.8.0

func (b Blockid) Compare(other Blockid) int

func (*Blockid) IsEmpty added in v0.8.0

func (b *Blockid) IsEmpty() bool

func (Blockid) Less added in v1.0.0

func (b Blockid) Less(than Blockid) bool

func (*Blockid) Marshal added in v0.8.0

func (b *Blockid) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*Blockid) MarshalTo added in v0.8.0

func (b *Blockid) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*Blockid) MarshalToSizedBuffer added in v0.8.0

func (b *Blockid) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (*Blockid) Offsets added in v0.8.0

func (b *Blockid) Offsets() (uint16, uint16)

func (*Blockid) ProtoSize added in v0.8.0

func (b *Blockid) ProtoSize() int

ProtoSize is used by gogoproto.

func (*Blockid) Segment added in v0.8.0

func (b *Blockid) Segment() *Segmentid

func (*Blockid) Sequence added in v0.8.0

func (b *Blockid) Sequence() uint16

func (*Blockid) ShortString added in v0.8.0

func (b *Blockid) ShortString() string

func (*Blockid) ShortStringEx added in v1.0.0

func (b *Blockid) ShortStringEx() string

func (*Blockid) String added in v0.8.0

func (b *Blockid) String() string

func (*Blockid) Unmarshal added in v0.8.0

func (b *Blockid) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type BuiltinNumber added in v0.6.0

type BuiltinNumber interface {
	Ints | UInts | Floats
}

type Date

type Date int32

func DateFromCalendar added in v0.7.0

func DateFromCalendar(year int32, month, day uint8) Date

func DecodeDate added in v0.6.0

func DecodeDate(v []byte) Date

func ParseDateCast added in v0.5.0

func ParseDateCast(s string) (Date, error)

rewrite ParseDateCast, don't use regexp, that's too slow the format we need to support: 1.yyyy-mm-dd hh:mm:ss.ms or yyyy-mm-dd hh:mm: or yyyy-mm-dd hh:mm 2.yyyy-mm-dd 3.yyyymmdd

func Today

func Today(loc *time.Location) Date

Today Holds number of days since January 1, year 1 in Gregorian calendar

func (Date) Calendar

func (d Date) Calendar(full bool) (year int32, month, day uint8, yday uint16)

func (Date) Day added in v0.5.0

func (d Date) Day() uint8

func (Date) DayOfWeek

func (d Date) DayOfWeek() Weekday

DayOfWeek return the day of the week counting from Sunday

func (Date) DayOfWeek2 added in v0.8.0

func (d Date) DayOfWeek2() Weekday

DayOfWeek2 return the day of the week counting from Monday

func (Date) DayOfYear

func (d Date) DayOfYear() uint16

DayOfYear return day of year (001..366)

func (Date) DaysSinceUnixEpoch added in v0.7.0

func (d Date) DaysSinceUnixEpoch() int32

func (Date) Month

func (d Date) Month() uint8

func (Date) Quarter added in v0.5.0

func (d Date) Quarter() uint32

func (Date) String

func (d Date) String() string

func (Date) ToDatetime added in v0.6.0

func (d Date) ToDatetime() Datetime

func (Date) ToTime

func (d Date) ToTime() Time

func (Date) ToTimestamp added in v0.6.0

func (d Date) ToTimestamp(loc *time.Location) Timestamp

func (Date) Week added in v0.6.0

func (d Date) Week(mode int) int

Week (00..53), where Sunday is the first day of the week; WEEK() mode 0 Week (00..53), where Monday is the first day of the week; WEEK() mode 1

func (Date) WeekOfYear

func (d Date) WeekOfYear() (year int32, week uint8)

func (Date) WeekOfYear2 added in v0.5.0

func (d Date) WeekOfYear2() uint8

func (Date) Year

func (d Date) Year() uint16

Year takes a date and returns an uint16 number as the year of this date

func (Date) YearMonth added in v0.5.0

func (d Date) YearMonth() uint32

func (Date) YearMonthStr added in v0.5.0

func (d Date) YearMonthStr() string

func (Date) YearWeek added in v0.6.0

func (d Date) YearWeek(mode int) (year int, week int)

YearWeek returns year and week.

type Datetime

type Datetime int64

func DatetimeFromClock added in v0.7.0

func DatetimeFromClock(year int32, month, day, hour, minute, sec uint8, msec uint32) Datetime

func DatetimeFromUnix added in v0.7.0

func DatetimeFromUnix(loc *time.Location, ts int64) Datetime

func DatetimeFromUnixWithNsec added in v0.7.0

func DatetimeFromUnixWithNsec(loc *time.Location, sec int64, nsec int64) Datetime

func DecodeDatetime added in v0.6.0

func DecodeDatetime(v []byte) Datetime

func Now

func Now(loc *time.Location) Datetime

func ParseDatetime

func ParseDatetime(s string, scale int32) (Datetime, error)

ParseDatetime will parse a string to be a Datetime Support Format: 1. all the Date value 2. yyyy-mm-dd hh:mm:ss(.msec) now support mm/dd/hh/mm/ss can be single number 3. yyyymmddhhmmss(.msec) during parsing, the Datetime value will be rounded(away from zero) to the predefined scale, for example: Datetime(3) input string parsing result

"1999-09-09 11:11:11.1234"		"1999-09-09 11:11:11.123"
"1999-09-09 11:11:11.1235"		"1999-09-09 11:11:11.124"
"1999-09-09 11:11:11.9994"      "1999-09-09 11:11:11.999"
"1999-09-09 11:11:11.9995"      "1999-09-09 11:11:12.000"
"1999-09-09 11:11"              "1999-09-09 11:11:00.000"
"1999-09-09 11:11:"             "1999-09-09 11:11:00.000"

func TimestampToDatetime added in v0.5.0

func TimestampToDatetime(loc *time.Location, xs []Timestamp, rs []Datetime) ([]Datetime, error)

func UTC added in v0.6.0

func UTC() Datetime

func (Datetime) AddDateTime added in v0.5.0

func (dt Datetime) AddDateTime(addMonth, addYear int64, timeType TimeType) (Datetime, bool)

func (Datetime) AddInterval added in v0.5.0

func (dt Datetime) AddInterval(nums int64, its IntervalType, timeType TimeType) (Datetime, bool)

AddInterval now date or datetime use the function to add/sub date, we need a bool arg to tell isDate/isDatetime date/datetime have different regions, so we don't use same valid function return type bool means the if the date/datetime is valid

func (Datetime) Clock

func (dt Datetime) Clock() (hour, minute, sec int8)

func (Datetime) ConvertToGoTime added in v0.5.0

func (dt Datetime) ConvertToGoTime(loc *time.Location) time.Time

func (Datetime) ConvertToMonth added in v0.6.0

func (dt Datetime) ConvertToMonth(secondDt Datetime) int64

func (Datetime) DateTimeDiffWithUnit added in v0.6.0

func (dt Datetime) DateTimeDiffWithUnit(its string, secondDt Datetime) (int64, error)

func (Datetime) DatetimeMinusWithSecond added in v0.6.0

func (dt Datetime) DatetimeMinusWithSecond(secondDt Datetime) int64

func (Datetime) Day added in v0.5.0

func (dt Datetime) Day() uint8

func (Datetime) DayHourStr added in v0.5.0

func (dt Datetime) DayHourStr() string

func (Datetime) DayMicrosecondStr added in v0.5.0

func (dt Datetime) DayMicrosecondStr() string

func (Datetime) DayMinuteStr added in v0.5.0

func (dt Datetime) DayMinuteStr() string

func (Datetime) DayOfWeek added in v0.6.0

func (dt Datetime) DayOfWeek() Weekday

func (Datetime) DayOfWeek2 added in v0.8.0

func (dt Datetime) DayOfWeek2() Weekday

func (Datetime) DayOfYear added in v0.6.0

func (dt Datetime) DayOfYear() uint16

func (Datetime) DaySecondStr added in v0.5.0

func (dt Datetime) DaySecondStr() string

func (Datetime) Hour added in v0.5.0

func (dt Datetime) Hour() int8

func (Datetime) HourMicrosecondStr added in v0.5.0

func (dt Datetime) HourMicrosecondStr() string

func (Datetime) HourMinuteStr added in v0.5.0

func (dt Datetime) HourMinuteStr() string

func (Datetime) HourSecondStr added in v0.5.0

func (dt Datetime) HourSecondStr() string

func (Datetime) MicroSec added in v0.5.0

func (dt Datetime) MicroSec() int64

func (Datetime) Minute added in v0.5.0

func (dt Datetime) Minute() int8

func (Datetime) MinuteMicrosecondStr added in v0.5.0

func (dt Datetime) MinuteMicrosecondStr() string

func (Datetime) MinuteSecondStr added in v0.5.0

func (dt Datetime) MinuteSecondStr() string

func (Datetime) Month

func (dt Datetime) Month() uint8

func (Datetime) Sec added in v0.5.0

func (dt Datetime) Sec() int8

func (Datetime) SecondMicrosecondStr added in v0.5.0

func (dt Datetime) SecondMicrosecondStr() string

func (Datetime) SecsSinceUnixEpoch added in v0.7.0

func (dt Datetime) SecsSinceUnixEpoch() int64

func (Datetime) String

func (dt Datetime) String() string

func (Datetime) String2 added in v0.5.0

func (dt Datetime) String2(scale int32) string

func (Datetime) ToDate

func (dt Datetime) ToDate() Date

func (Datetime) ToDecimal128 added in v0.8.0

func (dt Datetime) ToDecimal128() Decimal128

func (Datetime) ToDecimal64 added in v0.8.0

func (dt Datetime) ToDecimal64() Decimal64

func (Datetime) ToTime added in v0.6.0

func (dt Datetime) ToTime(scale int32) Time

We need to truncate the part after scale position when cast between different scale.

func (Datetime) ToTimestamp added in v0.6.0

func (dt Datetime) ToTimestamp(loc *time.Location) Timestamp

func (Datetime) UnixTimestamp added in v0.5.0

func (dt Datetime) UnixTimestamp(loc *time.Location) int64

func (Datetime) Week added in v0.6.0

func (dt Datetime) Week(mode int) int

func (Datetime) WeekOfYear added in v0.5.0

func (dt Datetime) WeekOfYear() (int32, uint8)

func (Datetime) Year

func (dt Datetime) Year() uint16

func (Datetime) YearMonthStr added in v0.5.0

func (dt Datetime) YearMonthStr() string

func (Datetime) YearWeek added in v0.6.0

func (dt Datetime) YearWeek(mode int) (year int, week int)

YearWeek returns year and week.

type Decimal added in v0.5.0

type Decimal interface {
	Decimal64 | Decimal128 | Decimal256
}

type Decimal128

type Decimal128 struct {
	B0_63   uint64
	B64_127 uint64
}

func Decimal128FromFloat64 added in v0.6.0

func Decimal128FromFloat64(x float64, width, scale int32) (y Decimal128, err error)

func DecodeDecimal128 added in v0.6.0

func DecodeDecimal128(v []byte) Decimal128

func Parse128 added in v0.8.0

func Parse128(x string) (y Decimal128, scale int32, err error)

func ParseDecimal128 added in v0.8.0

func ParseDecimal128(x string, width, scale int32) (y Decimal128, err error)

func ParseDecimal128FromByte added in v0.8.0

func ParseDecimal128FromByte(x string, width, scale int32) (y Decimal128, err error)

func (Decimal128) Add added in v0.6.0

func (x Decimal128) Add(y Decimal128, scale1, scale2 int32) (z Decimal128, scale int32, err error)

func (Decimal128) Add128 added in v0.8.0

func (x Decimal128) Add128(y Decimal128) (Decimal128, error)

func (Decimal128) Add64 added in v1.0.0

func (x Decimal128) Add64(y Decimal64) (Decimal128, error)

func (*Decimal128) AddInplace added in v1.0.0

func (x *Decimal128) AddInplace(y *Decimal128) (err error)

for performance sake, must make sure x and y has same scale, then call this function

func (Decimal128) Ceil added in v0.8.0

func (x Decimal128) Ceil(scale1, scale2 int32) Decimal128

func (Decimal128) Compare added in v0.6.0

func (x Decimal128) Compare(y Decimal128) int

func (Decimal128) Div added in v0.6.0

func (x Decimal128) Div(y Decimal128, scale1, scale2 int32) (z Decimal128, scale int32, err error)

func (Decimal128) Div128 added in v0.8.0

func (x Decimal128) Div128(y Decimal128) (Decimal128, error)

func (*Decimal128) Div128InPlace added in v1.0.0

func (x *Decimal128) Div128InPlace(y *Decimal128) error

func (Decimal128) Floor added in v0.8.0

func (x Decimal128) Floor(scale1, scale2 int32) Decimal128

func (Decimal128) Format added in v0.8.0

func (x Decimal128) Format(scale int32) string

func (Decimal128) Left added in v0.8.0

func (x Decimal128) Left(n int) (y Decimal128)

func (Decimal128) Less added in v0.8.0

func (x Decimal128) Less(y Decimal128) bool

func (Decimal128) Lt added in v0.6.0

func (x Decimal128) Lt(y Decimal128) bool

func (*Decimal128) Marshal added in v0.8.0

func (x *Decimal128) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*Decimal128) MarshalTo added in v0.8.0

func (x *Decimal128) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*Decimal128) MarshalToSizedBuffer added in v0.8.0

func (x *Decimal128) MarshalToSizedBuffer(data []byte) (int, error)

func (Decimal128) Minus added in v0.8.0

func (x Decimal128) Minus() Decimal128

func (*Decimal128) MinusInplace added in v1.0.0

func (x *Decimal128) MinusInplace()

func (Decimal128) Mod added in v0.8.0

func (x Decimal128) Mod(y Decimal128, scale1, scale2 int32) (z Decimal128, scale int32, err error)

func (Decimal128) Mod128 added in v0.8.0

func (x Decimal128) Mod128(y Decimal128) (Decimal128, error)

func (Decimal128) Mul added in v0.6.0

func (x Decimal128) Mul(y Decimal128, scale1, scale2 int32) (z Decimal128, scale int32, err error)

func (Decimal128) Mul128 added in v0.8.0

func (x Decimal128) Mul128(y Decimal128) (Decimal128, error)

func (*Decimal128) Mul128InPlace added in v1.0.0

func (x *Decimal128) Mul128InPlace(y *Decimal128) error

func (*Decimal128) Mul64InPlace added in v1.0.0

func (x *Decimal128) Mul64InPlace(y Decimal64) error

func (*Decimal128) MulInplace added in v1.0.0

func (x *Decimal128) MulInplace(y *Decimal128, scale, scale1, scale2 int32) (err error)

func (*Decimal128) ProtoSize added in v0.8.0

func (x *Decimal128) ProtoSize() int

ProtoSize is used by gogoproto.

func (Decimal128) Right added in v0.8.0

func (x Decimal128) Right(n int) (y Decimal128)

func (Decimal128) Round added in v0.8.0

func (x Decimal128) Round(scale1, scale2 int32) Decimal128

func (Decimal128) Scale added in v0.8.0

func (x Decimal128) Scale(n int32) (Decimal128, error)

func (*Decimal128) ScaleInplace added in v1.0.0

func (x *Decimal128) ScaleInplace(n int32) error

func (Decimal128) Sign added in v0.8.0

func (x Decimal128) Sign() bool

func (Decimal128) Sub added in v0.6.0

func (x Decimal128) Sub(y Decimal128, scale1, scale2 int32) (z Decimal128, scale int32, err error)

func (Decimal128) Sub128 added in v0.8.0

func (x Decimal128) Sub128(y Decimal128) (Decimal128, error)

func (*Decimal128) Unmarshal added in v0.8.0

func (x *Decimal128) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type Decimal256 added in v0.8.0

type Decimal256 struct {
	B0_63    uint64
	B64_127  uint64
	B128_191 uint64
	B192_255 uint64
}

func (Decimal256) Add256 added in v0.8.0

func (x Decimal256) Add256(y Decimal256) (Decimal256, error)

func (Decimal256) Compare added in v0.8.0

func (x Decimal256) Compare(y Decimal256) int

func (Decimal256) Div256 added in v0.8.0

func (x Decimal256) Div256(y Decimal256) (Decimal256, error)

func (Decimal256) Format added in v0.8.0

func (x Decimal256) Format(scale int32) string

func (Decimal256) Left added in v0.8.0

func (x Decimal256) Left(n int) (y Decimal256)

func (Decimal256) Less added in v0.8.0

func (x Decimal256) Less(y Decimal256) bool

func (Decimal256) Minus added in v0.8.0

func (x Decimal256) Minus() Decimal256

func (Decimal256) Mod256 added in v0.8.0

func (x Decimal256) Mod256(y Decimal256) (Decimal256, error)

func (Decimal256) Mul256 added in v0.8.0

func (x Decimal256) Mul256(y Decimal256) (Decimal256, error)

func (Decimal256) Right added in v0.8.0

func (x Decimal256) Right(n int) (y Decimal256)

func (Decimal256) Scale added in v0.8.0

func (x Decimal256) Scale(n int32) (Decimal256, error)

func (Decimal256) Sign added in v0.8.0

func (x Decimal256) Sign() bool

func (Decimal256) Sub256 added in v0.8.0

func (x Decimal256) Sub256(y Decimal256) (Decimal256, error)

type Decimal64

type Decimal64 uint64

func Decimal64FromFloat64 added in v0.6.0

func Decimal64FromFloat64(x float64, width, scale int32) (y Decimal64, err error)

func DecodeDecimal64 added in v0.6.0

func DecodeDecimal64(v []byte) Decimal64

func Parse64 added in v0.8.0

func Parse64(x string) (y Decimal64, scale int32, err error)

func ParseDecimal64 added in v0.8.0

func ParseDecimal64(x string, width, scale int32) (y Decimal64, err error)

func ParseDecimal64FromByte added in v0.8.0

func ParseDecimal64FromByte(x string, width, scale int32) (y Decimal64, err error)

func (Decimal64) Add added in v0.6.0

func (x Decimal64) Add(y Decimal64, scale1, scale2 int32) (z Decimal64, scale int32, err error)

func (Decimal64) Add64 added in v0.8.0

func (x Decimal64) Add64(y Decimal64) (Decimal64, error)

func (Decimal64) Ceil added in v0.8.0

func (x Decimal64) Ceil(scale1, scale2 int32) Decimal64

func (Decimal64) Compare added in v0.6.0

func (x Decimal64) Compare(y Decimal64) int

func (Decimal64) Div added in v0.6.0

func (x Decimal64) Div(y Decimal64, scale1, scale2 int32) (z Decimal64, scale int32, err error)

func (Decimal64) Div64 added in v0.8.0

func (x Decimal64) Div64(y Decimal64) (Decimal64, error)

func (Decimal64) Floor added in v0.8.0

func (x Decimal64) Floor(scale1, scale2 int32) Decimal64

func (Decimal64) Format added in v0.8.0

func (x Decimal64) Format(scale int32) string

func (Decimal64) Left added in v0.8.0

func (x Decimal64) Left(n int) (y Decimal64)

func (Decimal64) Less added in v0.8.0

func (x Decimal64) Less(y Decimal64) bool

func (Decimal64) Lt added in v0.6.0

func (x Decimal64) Lt(y Decimal64) bool

func (*Decimal64) Marshal added in v0.8.0

func (x *Decimal64) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*Decimal64) MarshalTo added in v0.8.0

func (x *Decimal64) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*Decimal64) MarshalToSizedBuffer added in v0.8.0

func (x *Decimal64) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (Decimal64) Minus added in v0.8.0

func (x Decimal64) Minus() Decimal64

func (Decimal64) Mod added in v0.8.0

func (x Decimal64) Mod(y Decimal64, scale1, scale2 int32) (z Decimal64, scale int32, err error)

func (Decimal64) Mod64 added in v0.8.0

func (x Decimal64) Mod64(y Decimal64) (Decimal64, error)

func (Decimal64) Mul added in v0.6.0

func (x Decimal64) Mul(y Decimal64, scale1, scale2 int32) (z Decimal64, scale int32, err error)

func (Decimal64) Mul64 added in v0.8.0

func (x Decimal64) Mul64(y Decimal64) (Decimal64, error)

func (*Decimal64) ProtoSize added in v0.8.0

func (x *Decimal64) ProtoSize() int

ProtoSize is used by gogoproto.

func (Decimal64) Right added in v0.8.0

func (x Decimal64) Right(n int) (y Decimal64)

func (Decimal64) Round added in v0.8.0

func (x Decimal64) Round(scale1, scale2 int32) Decimal64

func (Decimal64) Scale added in v0.8.0

func (x Decimal64) Scale(n int32) (Decimal64, error)

func (Decimal64) Sign added in v0.8.0

func (x Decimal64) Sign() bool

func (Decimal64) Sub added in v0.6.0

func (x Decimal64) Sub(y Decimal64, scale1, scale2 int32) (z Decimal64, scale int32, err error)

func (Decimal64) Sub64 added in v0.8.0

func (x Decimal64) Sub64(y Decimal64) (Decimal64, error)

func (*Decimal64) Unmarshal added in v0.8.0

func (x *Decimal64) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type Enum added in v1.0.0

type Enum uint16

func DecodeEnum added in v1.0.0

func DecodeEnum(v []byte) Enum

func ParseIntToEnum added in v1.0.0

func ParseIntToEnum(input int64) (Enum, error)

type FixedBytes added in v0.6.0

type FixedBytes interface {
	TS | Rowid
}

Fixed bytes. Deciaml64/128 and Varlena are not included because they has special meanings. In general you cannot compare them as bytes.

type FixedSizeT added in v0.6.0

type FixedSizeT interface {
	FixedSizeTExceptStrType | Varlena
}

FixedSized types in our type system. Esp, Varlena.

type FixedSizeTExceptStrType added in v0.8.0

type FixedSizeTExceptStrType interface {
	bool | OrderedT | Decimal | TS | Rowid | Uuid | Blockid
}

type Floats added in v0.5.0

type Floats interface {
	float32 | float64
}

type IntervalType added in v0.5.0

type IntervalType int8
const (
	IntervalTypeInvalid IntervalType = iota
	MicroSecond
	Second
	Minute
	Hour
	Day
	Week
	Month
	Quarter
	Year
	Second_MicroSecond
	Minute_MicroSecond
	Minute_Second
	Hour_MicroSecond
	Hour_Second
	Hour_Minute
	Day_MicroSecond
	Day_Second
	Day_Minute
	Day_Hour
	Year_Month
	IntervalTypeMax
)

func IntervalTypeOf added in v0.5.0

func IntervalTypeOf(s string) (IntervalType, error)

func NormalizeInterval added in v0.5.0

func NormalizeInterval(s string, it IntervalType) (ret int64, rettype IntervalType, err error)

func (IntervalType) String added in v0.5.0

func (it IntervalType) String() string

type Ints added in v0.5.0

type Ints interface {
	int8 | int16 | int32 | int64
}

type MockHLCClock added in v0.6.0

type MockHLCClock struct {
	// contains filtered or unexported fields
}

func NewMockHLCClock added in v0.6.0

func NewMockHLCClock(start int64) *MockHLCClock

Just for test , start >= 1

func (*MockHLCClock) Get added in v0.6.0

func (c *MockHLCClock) Get() timestamp.Timestamp

TODO::will be removed

func (*MockHLCClock) HasNetworkLatency added in v0.6.0

func (c *MockHLCClock) HasNetworkLatency() bool

func (*MockHLCClock) MaxOffset added in v0.6.0

func (c *MockHLCClock) MaxOffset() time.Duration

func (*MockHLCClock) Now added in v0.6.0

func (*MockHLCClock) SetNodeID added in v0.6.0

func (c *MockHLCClock) SetNodeID(id uint16)

func (*MockHLCClock) Update added in v0.6.0

func (c *MockHLCClock) Update(m timestamp.Timestamp)

type Number added in v0.5.0

type Number interface {
	Ints | UInts | Floats | Decimal
}

type ObjectBytes added in v0.8.0

type ObjectBytes = [ObjectBytesSize]byte

type OrderedT added in v0.6.0

type OrderedT interface {
	constraints.Ordered
}

type Packer added in v0.8.0

type Packer struct {
	// contains filtered or unexported fields
}

func NewPacker added in v0.6.0

func NewPacker(mp *mpool.MPool) *Packer

func NewPackerArray added in v0.6.0

func NewPackerArray(length int, mp *mpool.MPool) []*Packer

func (*Packer) Bytes added in v0.8.0

func (p *Packer) Bytes() []byte

func (*Packer) EncodeBool added in v0.8.0

func (p *Packer) EncodeBool(e bool)

func (*Packer) EncodeDate added in v0.8.0

func (p *Packer) EncodeDate(e Date)

func (*Packer) EncodeDatetime added in v0.8.0

func (p *Packer) EncodeDatetime(e Datetime)

func (*Packer) EncodeDecimal128 added in v0.8.0

func (p *Packer) EncodeDecimal128(e Decimal128)

func (*Packer) EncodeDecimal64 added in v0.8.0

func (p *Packer) EncodeDecimal64(e Decimal64)

func (*Packer) EncodeEnum added in v1.0.0

func (p *Packer) EncodeEnum(e Enum)

func (*Packer) EncodeFloat32 added in v0.8.0

func (p *Packer) EncodeFloat32(e float32)

func (*Packer) EncodeFloat64 added in v0.8.0

func (p *Packer) EncodeFloat64(e float64)

func (*Packer) EncodeInt16 added in v0.8.0

func (p *Packer) EncodeInt16(e int16)

func (*Packer) EncodeInt32 added in v0.8.0

func (p *Packer) EncodeInt32(e int32)

func (*Packer) EncodeInt64 added in v0.8.0

func (p *Packer) EncodeInt64(e int64)

func (*Packer) EncodeInt8 added in v0.8.0

func (p *Packer) EncodeInt8(e int8)

func (*Packer) EncodeStringType added in v0.8.0

func (p *Packer) EncodeStringType(e []byte)

func (*Packer) EncodeTime added in v0.8.0

func (p *Packer) EncodeTime(e Time)

func (*Packer) EncodeTimestamp added in v0.8.0

func (p *Packer) EncodeTimestamp(e Timestamp)

func (*Packer) EncodeUint16 added in v0.8.0

func (p *Packer) EncodeUint16(e uint16)

func (*Packer) EncodeUint32 added in v0.8.0

func (p *Packer) EncodeUint32(e uint32)

func (*Packer) EncodeUint64 added in v0.8.0

func (p *Packer) EncodeUint64(e uint64)

func (*Packer) EncodeUint8 added in v0.8.0

func (p *Packer) EncodeUint8(e uint8)

func (*Packer) FreeMem added in v0.8.0

func (p *Packer) FreeMem()

func (*Packer) GetBuf added in v0.8.0

func (p *Packer) GetBuf() []byte

func (*Packer) Reset added in v0.8.0

func (p *Packer) Reset()

type Rowid added in v0.6.0

type Rowid [RowidSize]byte

Rowid

func BuildTestRowid added in v0.8.0

func BuildTestRowid(a, b int64) (ret Rowid)

BuildTestRowid used only in unit test.

func RandomRowid added in v0.8.0

func RandomRowid() Rowid

func (*Rowid) BorrowBlockID added in v0.8.0

func (r *Rowid) BorrowBlockID() *Blockid

BorrowBlockID borrows block id from row id.

func (*Rowid) BorrowSegmentID added in v0.8.0

func (r *Rowid) BorrowSegmentID() *Segmentid

BorrowSegmentID borrows segment id from row id.

func (*Rowid) CloneBlockID added in v0.8.0

func (r *Rowid) CloneBlockID() Blockid

CloneBlockID clones the block id from row id.

func (*Rowid) CloneSegmentID added in v0.8.0

func (r *Rowid) CloneSegmentID() Segmentid

CloneSegmentID clones segment id from row id.

func (Rowid) Decode added in v0.8.0

func (r Rowid) Decode() (Blockid, uint32)

func (Rowid) Equal added in v0.8.0

func (r Rowid) Equal(to Rowid) bool

func (Rowid) Ge added in v0.8.0

func (r Rowid) Ge(than Rowid) bool

func (Rowid) GetBlockOffset added in v0.8.0

func (r Rowid) GetBlockOffset() uint16

func (Rowid) GetObject added in v0.8.0

func (r Rowid) GetObject() ObjectBytes

func (Rowid) GetObjectString added in v0.8.0

func (r Rowid) GetObjectString() string

func (Rowid) GetRowOffset added in v0.8.0

func (r Rowid) GetRowOffset() uint32

func (Rowid) Great added in v0.8.0

func (r Rowid) Great(than Rowid) bool

func (Rowid) Le added in v0.8.0

func (r Rowid) Le(than Rowid) bool

func (Rowid) Less added in v0.8.0

func (r Rowid) Less(than Rowid) bool

func (Rowid) NotEqual added in v0.8.0

func (r Rowid) NotEqual(to Rowid) bool

func (*Rowid) SetRowOffset added in v0.8.0

func (r *Rowid) SetRowOffset(offset uint32)

func (*Rowid) String added in v0.8.0

func (r *Rowid) String() string

type Segmentid added in v0.8.0

type Segmentid = Uuid

Segmentid

type T

type T uint8
const (
	// any family
	T_any  T = 0
	T_star T = 1

	// bool family
	T_bool T = 10

	// numeric/integer family
	T_int8    T = 20
	T_int16   T = 21
	T_int32   T = 22
	T_int64   T = 23
	T_int128  T = 24
	T_uint8   T = 25
	T_uint16  T = 26
	T_uint32  T = 27
	T_uint64  T = 28
	T_uint128 T = 29

	// numeric/float family
	T_float32 T = 30
	T_float64 T = 31

	// numeric/decimals
	T_decimal64  T = 32
	T_decimal128 T = 33
	T_decimal256 T = 34

	// date and time
	T_date      T = 50
	T_time      T = 51
	T_datetime  T = 52
	T_timestamp T = 53
	T_interval  T = 54

	// string family
	T_char      T = 60
	T_varchar   T = 61
	T_json      T = 62
	T_uuid      T = 63
	T_binary    T = 64
	T_varbinary T = 65
	T_enum      T = 66

	// blobs
	T_blob T = 70
	T_text T = 71

	// Transaction TS
	T_TS      T = 100
	T_Rowid   T = 101
	T_Blockid T = 102

	// system family
	T_tuple T = 201
)

func (T) FixedLength

func (t T) FixedLength() int

FixedLength dangerous code, use TypeLen() if you don't want -8, -16, -24

func (T) IsDateRelate added in v0.8.0

func (t T) IsDateRelate() bool

func (T) IsDecimal added in v0.8.0

func (t T) IsDecimal() bool

IsDecimal return true if the types.T is decimal64 or decimal128

func (T) IsFixedLen added in v0.8.0

func (t T) IsFixedLen() bool

func (T) IsFloat added in v0.8.0

func (t T) IsFloat() bool

IsFloat return true if the types.T is floating Point Types

func (T) IsInteger added in v0.8.0

func (t T) IsInteger() bool

IsInteger if expr type is integer return true,else return false

func (T) IsMySQLString added in v0.8.0

func (t T) IsMySQLString() bool

IsMySQLString return true if the types.T is a MySQL string type (https://dev.mysql.com/doc/refman/8.0/en/string-types.html) NOTE: types.IsVarlen() and t.IsMySQLString() are different. t.IsMySQLString() doesn't have T_Json type.

func (T) IsOrdered added in v0.8.0

func (t T) IsOrdered() bool

func (T) IsSignedInt added in v0.8.0

func (t T) IsSignedInt() bool

IsSignedInt return true if the types.T is Signed integer type

func (T) IsUnsignedInt added in v0.8.0

func (t T) IsUnsignedInt() bool

IsUnsignedInt return true if the types.T is UnSigned integer type

func (T) OidString

func (t T) OidString() string

OidString returns T string

func (T) String

func (t T) String() string

func (T) ToType

func (t T) ToType() Type

func (T) TypeLen

func (t T) TypeLen() int

TypeLen returns type's length whose type oid is T

type TS added in v0.6.0

type TS [TxnTsSize]byte

timestamp for transaction: physical time (higher 8 bytes) + logical (lower 4 bytes) See txts.go for impl.

var SystemDBTS TS

Why this was in package types?

func BuildTS added in v0.6.0

func BuildTS(p int64, l uint32) (ret TS)

func MaxTs added in v0.6.0

func MaxTs() TS

func NextGlobalTsForTest added in v0.6.0

func NextGlobalTsForTest() TS

func StringToTS added in v0.6.0

func StringToTS(s string) (ts TS)

func TimestampToTS added in v0.6.0

func TimestampToTS(ts timestamp.Timestamp) TS

TODO::need to take "NodeID" account into

func (TS) Compare added in v0.6.0

func (ts TS) Compare(rhs TS) int

Compare physical first then logical.

func (TS) Equal added in v0.6.0

func (ts TS) Equal(rhs TS) bool

func (TS) Greater added in v0.6.0

func (ts TS) Greater(rhs TS) bool

func (TS) GreaterEq added in v0.6.0

func (ts TS) GreaterEq(rhs TS) bool

func (TS) IsEmpty added in v0.6.0

func (ts TS) IsEmpty() bool

func (TS) Less added in v0.6.0

func (ts TS) Less(rhs TS) bool

func (TS) LessEq added in v0.6.0

func (ts TS) LessEq(rhs TS) bool

func (TS) Logical added in v0.6.0

func (ts TS) Logical() uint32

func (*TS) Marshal added in v0.8.0

func (ts *TS) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*TS) MarshalTo added in v0.8.0

func (ts *TS) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*TS) MarshalToSizedBuffer added in v0.8.0

func (ts *TS) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (TS) Next added in v0.6.0

func (ts TS) Next() TS

func (TS) Physical added in v0.6.0

func (ts TS) Physical() int64

Transaction ts contains a physical ts in higher 8 bytes and a logical in lower 4 bytes. higher lower in little ending sense.

func (TS) Prev added in v0.6.0

func (ts TS) Prev() TS

Who use this function?

func (*TS) ProtoSize added in v0.8.0

func (ts *TS) ProtoSize() int

ProtoSize is used by gogoproto.

func (TS) ToString added in v0.6.0

func (ts TS) ToString() string

func (TS) ToTimestamp added in v0.6.0

func (ts TS) ToTimestamp() timestamp.Timestamp

func (*TS) Unmarshal added in v0.8.0

func (ts *TS) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type Time added in v0.6.0

type Time int64

func DecodeTime added in v0.6.0

func DecodeTime(v []byte) Time

func ParseDecimal128ToTime added in v0.8.0

func ParseDecimal128ToTime(input Decimal128, scale1, scale2 int32) (Time, error)

func ParseDecimal64ToTime added in v0.8.0

func ParseDecimal64ToTime(input Decimal64, scale1, scale2 int32) (Time, error)

func ParseInt64ToTime added in v0.6.0

func ParseInt64ToTime(input int64, scale int32) (Time, error)

func ParseTime added in v0.6.0

func ParseTime(s string, scale int32) (Time, error)

During parsing, if the input length of msec is larger than predefined scale, it will be rounded eg.

Time(3) input string   		parsing result
"11:11:11.1234"			"11:11:11.123"
"11:11:11.1235"			"11:11:11.124"
"11:11:11.9994"      		"11:11:11.999"
"11:11:11.9995"      		"11:11:12.000"
"-11:11:11.1235"		"-11:11:11.124"
"-11:11:11.9995"      		"-11:11:12.000"

func TimeFromClock added in v0.7.0

func TimeFromClock(isNegative bool, hour uint64, minute, sec uint8, msec uint32) Time

func (Time) AddInterval added in v0.6.0

func (t Time) AddInterval(nums int64, its IntervalType) (Time, bool)

AddInterval now date or time use the function to add/sub date, return type bool means the if the time is valid

func (Time) ClockFormat added in v0.6.0

func (t Time) ClockFormat() (hour uint64, minute, sec uint8, msec uint64, isNeg bool)

ClockFormat: symbol part/hour part/minute part/second part/msecond part

func (Time) ConvertToInterval added in v0.6.0

func (t Time) ConvertToInterval(ctx context.Context, its string) (int64, error)

func (Time) Hour added in v0.6.0

func (t Time) Hour() int64

func (Time) MicroSec added in v0.6.0

func (t Time) MicroSec() int64

func (Time) Minute added in v0.6.0

func (t Time) Minute() int8

func (Time) NumericString added in v0.6.0

func (t Time) NumericString(scale int32) string

Format: hhmmss.msec TODO: add the carry when truncate

func (Time) Sec added in v0.6.0

func (t Time) Sec() int8

func (Time) String added in v0.6.0

func (t Time) String() string

no msec part Format: hh:mm:ss

func (Time) String2 added in v0.6.0

func (t Time) String2(scale int32) string

Format: hh:mm:ss.msec

func (Time) ToDate added in v0.6.0

func (t Time) ToDate() Date

TODO: Get Today date from local time zone setting?

func (Time) ToDatetime added in v0.6.0

func (t Time) ToDatetime(scale int32) Datetime

We need to truncate the part after scale position when cast between different scale.

func (Time) ToDecimal128 added in v0.6.0

func (t Time) ToDecimal128(ctx context.Context, width, scale int32) (Decimal128, error)

func (Time) ToDecimal64 added in v0.6.0

func (t Time) ToDecimal64(ctx context.Context, width, scale int32) (Decimal64, error)

func (Time) ToInt64 added in v0.6.0

func (t Time) ToInt64() int64

type TimeType added in v0.5.0

type TimeType int32

type Timestamp added in v0.5.0

type Timestamp int64
var TimestampMaxValue Timestamp
var TimestampMinValue Timestamp

func CurrentTimestamp added in v0.6.0

func CurrentTimestamp() Timestamp

func DecodeTimestamp added in v0.6.0

func DecodeTimestamp(v []byte) Timestamp

func FromClockUTC added in v0.5.0

func FromClockUTC(year int32, month, day, hour, minute, sec uint8, msec uint32) Timestamp

FromClockUTC gets the utc time value in Timestamp

func FromClockZone added in v0.6.0

func FromClockZone(loc *time.Location, year int32, month, day, hour, minute, sec uint8, msec uint32) Timestamp

FromClockZone gets the local time value in Timestamp

func ParseTimestamp added in v0.5.0

func ParseTimestamp(loc *time.Location, s string, scale int32) (Timestamp, error)

ParseTimestamp will parse a string to be a Timestamp Support Format: 1. all the Date value 2. yyyy-mm-dd hh:mm:ss(.msec) 3. yyyymmddhhmmss(.msec)

func UnixMicroToTimestamp added in v0.6.0

func UnixMicroToTimestamp(ts int64) Timestamp

func UnixNanoToTimestamp added in v0.7.0

func UnixNanoToTimestamp(ts int64) Timestamp

func UnixToTimestamp added in v0.5.0

func UnixToTimestamp(ts int64) Timestamp

func (Timestamp) String added in v0.5.0

func (ts Timestamp) String() string

func (Timestamp) String2 added in v0.5.0

func (ts Timestamp) String2(loc *time.Location, scale int32) string

String2 stringify timestamp, including its fractional seconds precision part(fsp)

func (Timestamp) ToDatetime added in v0.8.0

func (ts Timestamp) ToDatetime(loc *time.Location) Datetime

func (Timestamp) Unix added in v0.6.0

func (ts Timestamp) Unix() int64

func (Timestamp) UnixToDecimal128 added in v0.6.0

func (ts Timestamp) UnixToDecimal128() (Decimal128, error)

func (Timestamp) UnixToDecimal64 added in v0.8.0

func (ts Timestamp) UnixToDecimal64() (Decimal64, error)

func (Timestamp) UnixToFloat added in v0.6.0

func (ts Timestamp) UnixToFloat() float64

type TsAlloctor added in v0.6.0

type TsAlloctor struct {
	// contains filtered or unexported fields
}
var (
	//just for test
	GlobalTsAlloctor *TsAlloctor
)

TAE test infra, should move out

func NewTsAlloctor added in v0.6.0

func NewTsAlloctor(clock clock.Clock) *TsAlloctor

func (*TsAlloctor) Alloc added in v0.6.0

func (alloc *TsAlloctor) Alloc() TS

func (*TsAlloctor) Get added in v0.6.0

func (alloc *TsAlloctor) Get() TS

TODO::will be removed

func (*TsAlloctor) SetStart added in v0.6.0

func (alloc *TsAlloctor) SetStart(start TS)

type Tuple added in v0.6.0

type Tuple []TupleElement

func Unpack added in v0.6.0

func Unpack(b []byte) (Tuple, error)

func (Tuple) ErrString added in v0.8.0

func (tp Tuple) ErrString() string

func (Tuple) String added in v0.6.0

func (tp Tuple) String() string

type TupleElement added in v0.6.0

type TupleElement any

type Type

type Type struct {
	Oid T

	// XXX Dummies.  T is uint8, make it 4 bytes aligned, otherwise, it may contain
	// garbage data.  In theory these unused garbage should not be a problem, but
	// it is.  Give it a name will zero fill it ...
	Charset uint8

	Size int32
	// Width means max Display width for float and double, char and varchar
	// todo: need to add new attribute DisplayWidth ?
	Width int32
	// Scale means number of fractional digits for decimal, timestamp, float, etc.
	Scale int32
	// contains filtered or unexported fields
}
var CompoundKeyType Type

CompoundKeyType -- this is simply deadly wrong thing.

func DecodeType added in v0.6.0

func DecodeType(v []byte) Type

func MockColTypes added in v0.6.0

func MockColTypes(colCnt int) (ct []Type)

func New added in v0.5.0

func New(oid T, width, scale int32) Type

func (Type) DescString added in v0.7.0

func (t Type) DescString() string

func (Type) Eq

func (t Type) Eq(b Type) bool

func (Type) GetNotNull added in v0.8.0

func (t Type) GetNotNull() bool

func (Type) GetSize added in v0.8.0

func (t Type) GetSize() int32

func (Type) IsBoolean added in v0.6.0

func (t Type) IsBoolean() bool

func (Type) IsDecimal added in v0.8.0

func (t Type) IsDecimal() bool

func (Type) IsFixedLen added in v0.6.0

func (t Type) IsFixedLen() bool

func (Type) IsFloat added in v0.6.0

func (t Type) IsFloat() bool

func (Type) IsInt added in v0.6.0

func (t Type) IsInt() bool

func (Type) IsIntOrUint added in v0.6.0

func (t Type) IsIntOrUint() bool

func (Type) IsNumeric added in v1.0.0

func (t Type) IsNumeric() bool

func (Type) IsNumericOrTemporal added in v0.8.0

func (t Type) IsNumericOrTemporal() bool

func (Type) IsTemporal added in v0.8.0

func (t Type) IsTemporal() bool

func (Type) IsTuple added in v0.6.0

func (t Type) IsTuple() bool

Special

func (Type) IsUInt added in v0.6.0

func (t Type) IsUInt() bool

func (Type) IsVarlen added in v0.6.0

func (t Type) IsVarlen() bool

func (*Type) Marshal added in v0.8.0

func (t *Type) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*Type) MarshalBinary added in v0.8.0

func (t *Type) MarshalBinary() ([]byte, error)

func (*Type) MarshalTo added in v0.8.0

func (t *Type) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*Type) MarshalToSizedBuffer added in v0.8.0

func (t *Type) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (*Type) ProtoSize added in v0.8.0

func (t *Type) ProtoSize() int

ProtoSize is used by gogoproto.

func (*Type) SetNotNull added in v0.8.0

func (t *Type) SetNotNull(b bool)

func (Type) String

func (t Type) String() string

func (Type) TypeSize added in v0.5.1

func (t Type) TypeSize() int

func (*Type) Unmarshal added in v0.8.0

func (t *Type) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

func (*Type) UnmarshalBinary added in v0.8.0

func (t *Type) UnmarshalBinary(data []byte) error

type UInts added in v0.5.0

type UInts interface {
	uint8 | uint16 | uint32 | uint64
}

type Uuid added in v0.6.0

type Uuid [16]byte

UUID is Version 1 UUID based on the current NodeID and clock sequence, and the current time.

func BuildUuid added in v0.6.0

func BuildUuid() (Uuid, error)

func DecodeUuid added in v0.6.0

func DecodeUuid(v []byte) Uuid

func ParseUuid added in v0.6.0

func ParseUuid(str string) (Uuid, error)

func (Uuid) ClockSequence added in v0.6.0

func (d Uuid) ClockSequence() int

func (Uuid) Compare added in v0.6.0

func (d Uuid) Compare(other Uuid) int

func (Uuid) Eq added in v0.6.0

func (d Uuid) Eq(other Uuid) bool

func (Uuid) Ge added in v0.6.0

func (d Uuid) Ge(other Uuid) bool

func (Uuid) Gt added in v0.6.0

func (d Uuid) Gt(other Uuid) bool

func (Uuid) Le added in v0.6.0

func (d Uuid) Le(other Uuid) bool

func (Uuid) Lt added in v0.6.0

func (d Uuid) Lt(other Uuid) bool

func (*Uuid) Marshal added in v0.8.0

func (d *Uuid) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*Uuid) MarshalTo added in v0.8.0

func (d *Uuid) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*Uuid) MarshalToSizedBuffer added in v0.8.0

func (d *Uuid) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (Uuid) Ne added in v0.6.0

func (d Uuid) Ne(other Uuid) bool

func (*Uuid) ProtoSize added in v0.8.0

func (d *Uuid) ProtoSize() int

ProtoSize is used by gogoproto.

func (Uuid) ToString added in v0.6.0

func (d Uuid) ToString() string

func (*Uuid) Unmarshal added in v0.8.0

func (d *Uuid) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type Varlena added in v0.6.0

type Varlena [VarlenaSize]byte

func BuildVarlena added in v0.6.0

func BuildVarlena(bs []byte, area []byte, m *mpool.MPool) (Varlena, []byte, error)

do not use this function, will be deleted in the future use BuildVarlenaFromValena or BuildVarlenaFromByteSlice instead

func (*Varlena) ByteSlice added in v0.6.0

func (v *Varlena) ByteSlice() []byte

func (*Varlena) GetByteSlice added in v0.6.0

func (v *Varlena) GetByteSlice(area []byte) []byte

For short slice, this one will return a slice stored internal in the varlena. Caller must ensure that v has a longer life span than the returned byte slice.

Main user of Varlena is vector. v that comes from vector.Data will be fine.

func (*Varlena) GetString added in v0.6.0

func (v *Varlena) GetString(area []byte) string

See the lifespan comment above.

func (*Varlena) IsSmall added in v0.6.0

func (v *Varlena) IsSmall() bool

func (*Varlena) OffsetLen added in v0.6.0

func (v *Varlena) OffsetLen() (uint32, uint32)

func (*Varlena) Reset added in v0.6.0

func (v *Varlena) Reset()

func (*Varlena) SetOffsetLen added in v0.6.0

func (v *Varlena) SetOffsetLen(voff, vlen uint32)

func (*Varlena) U32Slice added in v0.6.0

func (v *Varlena) U32Slice() []uint32

func (*Varlena) UnsafePtr added in v0.7.0

func (v *Varlena) UnsafePtr() unsafe.Pointer

type WeekBehaviour added in v0.8.0

type WeekBehaviour uint

type Weekday

type Weekday uint8
const (
	Sunday Weekday = iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

func (Weekday) String added in v0.6.0

func (d Weekday) String() string

String returns the English name of the day ("Sunday", "Monday", ...).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL