types

package
v3.0.0-beta5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date uint16

two bytes as the number of days since 1970-01-01 (unsigned).

func TimeToDate

func TimeToDate(t time.Time) Date

func (Date) Append

func (d Date) Append(b []byte, loc *time.Location, precision int) []byte

func (Date) FromTime

func (d Date) FromTime(v time.Time, precision int) Date

func (Date) GetCHType

func (d Date) GetCHType() string

func (Date) ToTime

func (d Date) ToTime(loc *time.Location, precision int) time.Time

func (Date) Unix

func (d Date) Unix() int64

type Date32

type Date32 int32

func TimeToDate32

func TimeToDate32(t time.Time) Date32

func (Date32) Append

func (d Date32) Append(b []byte, loc *time.Location, precision int) []byte

func (Date32) FromTime

func (d Date32) FromTime(v time.Time, precision int) Date32

func (Date32) GetCHType

func (d Date32) GetCHType() string

func (Date32) ToTime

func (d Date32) ToTime(loc *time.Location, precision int) time.Time

func (Date32) Unix

func (d Date32) Unix() int64

type DateTime

type DateTime uint32

func TimeToDateTime

func TimeToDateTime(t time.Time) DateTime

func (DateTime) Append

func (d DateTime) Append(b []byte, loc *time.Location, precision int) []byte

func (DateTime) FromTime

func (d DateTime) FromTime(v time.Time, precision int) DateTime

func (DateTime) GetCHType

func (d DateTime) GetCHType() string

func (DateTime) ToTime

func (d DateTime) ToTime(loc *time.Location, precision int) time.Time

type DateTime64

type DateTime64 int64

func TimeToDateTime64

func TimeToDateTime64(t time.Time, precision int) DateTime64

func (DateTime64) Append

func (d DateTime64) Append(b []byte, loc *time.Location, precision int) []byte

func (DateTime64) FromTime

func (d DateTime64) FromTime(v time.Time, precision int) DateTime64

func (DateTime64) GetCHType

func (d DateTime64) GetCHType() string

func (DateTime64) ToTime

func (d DateTime64) ToTime(loc *time.Location, precision int) time.Time

type Decimal128

type Decimal128 Int128

Decimal128 represents a 128-bit decimal number.

func (Decimal128) Append

func (d Decimal128) Append(scale int, b []byte) []byte

Float64 converts decimal number to float64.

func (Decimal128) Float64

func (d Decimal128) Float64(scale int) float64

Float64 converts decimal number to float64.

func (Decimal128) String

func (d Decimal128) String(scale int) string

Float64 converts decimal number to string.

func (Decimal128) ToInt128

func (d Decimal128) ToInt128(scale int) Int128

type Decimal256

type Decimal256 Int256

Decimal256 represents a 256-bit decimal number.

func (Decimal256) Append

func (d Decimal256) Append(scale int, b []byte) []byte

Float64 converts decimal number to float64.

func (Decimal256) Float64

func (d Decimal256) Float64(scale int) float64

Float64 converts decimal number to float64.

func (Decimal256) String

func (d Decimal256) String(scale int) string

Float64 converts decimal number to string.

func (Decimal256) ToInt256

func (d Decimal256) ToInt256(scale int) Int256

type Decimal32

type Decimal32 int32

Decimal32 represents a 32-bit decimal number.

func Decimal32FromFloat64

func Decimal32FromFloat64(f float64, scale int) Decimal32

Decimal32FromFloat64 converts float64 to decimal32 number.

func (Decimal32) Append

func (d Decimal32) Append(scale int, b []byte) []byte

func (Decimal32) Float64

func (d Decimal32) Float64(scale int) float64

Float64 converts decimal number to float64.

func (Decimal32) String

func (d Decimal32) String(scale int) string

type Decimal64

type Decimal64 int64

Decimal64 represents a 64-bit decimal number.

func Decimal64FromFloat64

func Decimal64FromFloat64(f float64, scale int) Decimal64

Decimal64FromFloat64 converts float64 to decimal64 number.

func (Decimal64) Append

func (d Decimal64) Append(scale int, b []byte) []byte

func (Decimal64) Float64

func (d Decimal64) Float64(scale int) float64

Float64 converts decimal number to float64.

func (Decimal64) String

func (d Decimal64) String(scale int) string

type IPv4

type IPv4 [4]byte
IPv4 is a compatible type for IPv4 address in clickhouse.

clickhouse use Little endian for IPv4. but golang use big endian

func IPv4FromAddr

func IPv4FromAddr(ipAddr netip.Addr) IPv4

func (IPv4) Append

func (ip IPv4) Append(b []byte) []byte

func (IPv4) MarshalText

func (ip IPv4) MarshalText() ([]byte, error)

func (IPv4) NetIP

func (ip IPv4) NetIP() netip.Addr

type IPv6

type IPv6 [16]byte

func IPv6FromAddr

func IPv6FromAddr(ipAddr netip.Addr) IPv6

func (IPv6) Append

func (ip IPv6) Append(b []byte) []byte

func (IPv6) MarshalText

func (ip IPv6) MarshalText() ([]byte, error)

func (IPv6) NetIP

func (ip IPv6) NetIP() netip.Addr

type Int128

type Int128 struct {
	Lo uint64 // lower 64-bit half
	Hi int64  // upper 64-bit half
}

Int128 is an signed 128-bit number. All methods are immutable, works just like standard uint64.

func Int128From64

func Int128From64(v int64) Int128

From64 converts 64-bit value v to a Int128 value. Upper 64-bit half will be zero.

func Int128FromBig

func Int128FromBig(i *big.Int) Int128

FromBig converts *big.Int to 128-bit Int128 value ignoring overflows. If input integer is nil or negative then return Zero. If input interger overflows 128-bit then return Max.

func Int128FromBigEx

func Int128FromBigEx(i *big.Int) (Int128, bool)

FromBigEx converts *big.Int to 128-bit Int128 value (eXtended version). Provides ok successful flag as a second return value. If input integer is negative or overflows 128-bit then ok=false. If input is nil then zero 128-bit returned.

func Int128Max

func Int128Max() Int128

Max is the largest possible Int128 value.

func Int128Zero

func Int128Zero() Int128

Zero is the lowest possible Int128 value.

func (Int128) Append

func (u Int128) Append(b []byte) []byte

func (Int128) Big

func (u Int128) Big() *big.Int

Big returns 128-bit value as a *big.Int.

func (Int128) Equals

func (u Int128) Equals(v Int128) bool

Equals returns true if two 128-bit values are equal. Int128 values can be compared directly with == operator but use of the Equals method is preferred for consistency.

func (Int128) Neg

func (u Int128) Neg() (z Int128)

Neg returns the additive inverse of an Int128

func (Int128) String

func (u Int128) String() string

func (Int128) Uint128

func (u Int128) Uint128() Uint128

func (Int128) Uint64

func (u Int128) Uint64() uint64

func (Int128) Zero

func (u Int128) Zero() bool

Zero returns true if this is a zero value.

type Int256

type Int256 struct {
	Lo Uint128 // lower 128-bit half
	Hi Int128  // upper 128-bit half
}

Int256 is an unsigned 256-bit number. All methods are immutable, works just like standard uint64.

func Int256From128

func Int256From128(v Int128) Int256

func Int256From64

func Int256From64(v int64) Int256

From64 converts 64-bit value v to a Int256 value. Upper 128-bit half will be zero.

func Int256FromBig

func Int256FromBig(i *big.Int) Int256

FromBig converts *big.Int to 256-bit Int256 value ignoring overflows. If input integer is nil or negative then return Zero. If input integer overflows 256-bit then return Max.

func Int256FromBigEx

func Int256FromBigEx(i *big.Int) (Int256, bool)

FromBigEx converts *big.Int to 256-bit Int256 value (eXtended version). Provides ok successful flag as a second return value. If input integer is negative or overflows 256-bit then ok=false. If input is nil then zero 256-bit returned.

func Int256Max

func Int256Max() Int256

Max is the largest possible Int256 value.

func Int256Zero

func Int256Zero() Int256

Zero is the lowest possible Int256 value.

func (Int256) Append

func (u Int256) Append(b []byte) []byte

func (Int256) Big

func (u Int256) Big() *big.Int

Big returns 256-bit value as a *big.Int.

func (Int256) Equals

func (u Int256) Equals(v Int256) bool

Equals returns true if two 256-bit values are equal. Int256 values can be compared directly with == operator but use of the Equals method is preferred for consistency.

func (Int256) String

func (u Int256) String() string

func (Int256) Uint128

func (u Int256) Uint128() Uint128

func (Int256) Uint256

func (u Int256) Uint256() Uint256

func (Int256) Uint64

func (u Int256) Uint64() uint64

func (Int256) Zero

func (u Int256) Zero() bool

type Point

type Point Tuple2[float64, float64]

type Tuple2

type Tuple2[T1, T2 any] struct {
	Col1 T1
	Col2 T2
}

type Tuple3

type Tuple3[T1, T2, T3 any] struct {
	Col1 T1
	Col2 T2
	Col3 T3
}

type Tuple4

type Tuple4[T1, T2, T3, T4 any] struct {
	Col1 T1
	Col2 T2
	Col3 T3
	Col4 T4
}

type Tuple5

type Tuple5[T1, T2, T3, T4, T5 any] struct {
	Col1 T1
	Col2 T2
	Col3 T3
	Col4 T4
	Col5 T5
}

type UUID

type UUID [16]byte

func UUIDFromBigEndian

func UUIDFromBigEndian(b [16]byte) UUID

func (UUID) Append

func (u UUID) Append(b []byte) []byte

func (UUID) BigEndian

func (u UUID) BigEndian() [16]byte

type Uint128

type Uint128 struct {
	Lo uint64 // lower 64-bit half
	Hi uint64 // upper 64-bit half
}

Uint128 is an unsigned 128-bit number. All methods are immutable, works just like standard uint64.

func Uint128From64

func Uint128From64(v uint64) Uint128

From64 converts 64-bit value v to a Uint128 value. Upper 64-bit half will be zero.

func Uint128FromBig

func Uint128FromBig(i *big.Int) Uint128

FromBig converts *big.Int to 128-bit Uint128 value ignoring overflows. If input integer is nil or negative then return Zero. If input interger overflows 128-bit then return Max.

func Uint128FromBigEx

func Uint128FromBigEx(i *big.Int) (Uint128, bool)

FromBigEx converts *big.Int to 128-bit Uint128 value (eXtended version). Provides ok successful flag as a second return value. If input integer is negative or overflows 128-bit then ok=false. If input is nil then zero 128-bit returned.

func Uint128Max

func Uint128Max() Uint128

Max is the largest possible Uint128 value.

func Uint128Zero

func Uint128Zero() Uint128

Zero is the lowest possible Uint128 value.

func (Uint128) Append

func (u Uint128) Append(b []byte) []byte

func (Uint128) Big

func (u Uint128) Big() *big.Int

Big returns 128-bit value as a *big.Int.

func (Uint128) Equals

func (u Uint128) Equals(v Uint128) bool

Equals returns true if two 128-bit values are equal. Uint128 values can be compared directly with == operator but use of the Equals method is preferred for consistency.

func (Uint128) Int128

func (u Uint128) Int128() Int128

Equals returns true if two 128-bit values are equal. Uint128 values can be compared directly with == operator but use of the Equals method is preferred for consistency.

func (Uint128) String

func (u Uint128) String() string

func (Uint128) Uint64

func (u Uint128) Uint64() uint64

func (Uint128) Zero

func (u Uint128) Zero() bool

Zero returns true if Uint128 value is zero.

type Uint256

type Uint256 struct {
	Lo Uint128 // lower 128-bit half
	Hi Uint128 // upper 128-bit half
}

Uint256 is an unsigned 256-bit number. All methods are immutable, works just like standard uint64.

func Uint256From128

func Uint256From128(v Uint128) Uint256

From128 converts 128-bit value v to a Uint256 value. Upper 128-bit half will be zero.

func Uint256From64

func Uint256From64(v uint64) Uint256

From64 converts 64-bit value v to a Uint256 value. Upper 128-bit half will be zero.

func Uint256FromBig

func Uint256FromBig(i *big.Int) Uint256

FromBig converts *big.Int to 256-bit Uint256 value ignoring overflows. If input integer is nil or negative then return Zero. If input interger overflows 256-bit then return Max.

func Uint256FromBigEx

func Uint256FromBigEx(i *big.Int) (Uint256, bool)

FromBigEx converts *big.Int to 256-bit Uint256 value (eXtended version). Provides ok successful flag as a second return value. If input integer is negative or overflows 256-bit then ok=false. If input is nil then zero 256-bit returned.

func Uint256Max

func Uint256Max() Uint256

Max is the largest possible Uint256 value.

func Uint256Zero

func Uint256Zero() Uint256

Zero is the lowest possible Uint256 value.

func (Uint256) Append

func (u Uint256) Append(b []byte) []byte

func (Uint256) Big

func (u Uint256) Big() *big.Int

Big returns 256-bit value as a *big.Int.

func (Uint256) Equals

func (u Uint256) Equals(v Uint256) bool

Equals returns true if two 256-bit values are equal. Uint256 values can be compared directly with == operator but use of the Equals method is preferred for consistency.

func (Uint256) Int256

func (u Uint256) Int256() Int256

func (Uint256) String

func (u Uint256) String() string

func (Uint256) Uint128

func (u Uint256) Uint128() Uint128

func (Uint256) Uint64

func (u Uint256) Uint64() uint64

Jump to

Keyboard shortcuts

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