types

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date uint16

func TimeToDate

func TimeToDate(t time.Time) Date

func (Date) FromTime

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

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) FromTime

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

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) FromTime

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

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) FromTime

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

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.

type Decimal256

type Decimal256 Int256

Decimal256 represents a 256-bit decimal number.

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) Float64

func (d Decimal32) Float64(scale int) float64

Float64 converts decimal number to float64.

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) Float64

func (d Decimal64) Float64(scale int) float64

Float64 converts decimal number to float64.

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) NetIP

func (ip IPv4) NetIP() netip.Addr

type IPv6

type IPv6 [16]byte

func IPv6FromAddr

func IPv6FromAddr(ipAddr netip.Addr) IPv6

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 unsigned 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) 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

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

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

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) 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) Neg

func (u Int256) Neg() (z Int256)

Neg returns the additive inverse of an Int256

type Point

type Point Tuple2[float64, float64]

type Tuple2 added in v2.2.0

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

type Tuple3 added in v2.2.0

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

type Tuple4 added in v2.2.0

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

type Tuple5 added in v2.2.0

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) 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) 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.

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) 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.

Jump to

Keyboard shortcuts

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