scalar

package
v3.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MPL-2.0, MIT Imports: 19 Imported by: 0

README

CloudQuery Type System

This directory is heavily based on jackc/pgtype and modified per CQ needs and thus fall under the original MIT license and copyright.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToBuilder

func AppendToBuilder(bldr array.Builder, s Scalar)

func AppendToRecordBuilder

func AppendToRecordBuilder(bldr *array.RecordBuilder, vector Vector)

Types

type Binary

type Binary struct {
	Valid bool
	Value []byte
}

func (*Binary) DataType

func (*Binary) DataType() arrow.DataType

func (*Binary) Equal

func (s *Binary) Equal(rhs Scalar) bool

func (*Binary) Get added in v3.6.4

func (s *Binary) Get() any

func (*Binary) IsValid

func (s *Binary) IsValid() bool

func (*Binary) Set

func (s *Binary) Set(val any) error

func (*Binary) String

func (s *Binary) String() string

type Bool

type Bool struct {
	Valid bool
	Value bool
}

func (*Bool) DataType

func (*Bool) DataType() arrow.DataType

func (*Bool) Equal

func (s *Bool) Equal(rhs Scalar) bool

func (*Bool) Get added in v3.6.4

func (s *Bool) Get() any

func (*Bool) IsValid

func (s *Bool) IsValid() bool

func (*Bool) Set

func (s *Bool) Set(val any) error

func (*Bool) String

func (s *Bool) String() string

type Date32 added in v3.9.0

type Date32 struct {
	Valid bool
	Value arrow.Date32
}

func (*Date32) DataType added in v3.9.0

func (*Date32) DataType() arrow.DataType

func (*Date32) Equal added in v3.9.0

func (s *Date32) Equal(rhs Scalar) bool

func (*Date32) Get added in v3.9.0

func (s *Date32) Get() any

func (*Date32) IsValid added in v3.9.0

func (s *Date32) IsValid() bool

func (*Date32) Set added in v3.9.0

func (s *Date32) Set(val any) error

func (*Date32) String added in v3.9.0

func (s *Date32) String() string

type Date64 added in v3.9.0

type Date64 struct {
	Valid bool
	Value arrow.Date64
}

func (*Date64) DataType added in v3.9.0

func (*Date64) DataType() arrow.DataType

func (*Date64) Equal added in v3.9.0

func (s *Date64) Equal(rhs Scalar) bool

func (*Date64) Get added in v3.9.0

func (s *Date64) Get() any

func (*Date64) IsValid added in v3.9.0

func (s *Date64) IsValid() bool

func (*Date64) Set added in v3.9.0

func (s *Date64) Set(val any) error

func (*Date64) String added in v3.9.0

func (s *Date64) String() string

type DayTimeInterval added in v3.9.0

type DayTimeInterval struct {
	Value arrow.DayTimeInterval
	Valid bool
}

func (*DayTimeInterval) DataType added in v3.9.0

func (*DayTimeInterval) DataType() arrow.DataType

func (*DayTimeInterval) Equal added in v3.9.0

func (s *DayTimeInterval) Equal(rhs Scalar) bool

func (*DayTimeInterval) Get added in v3.9.0

func (s *DayTimeInterval) Get() any

func (*DayTimeInterval) IsValid added in v3.9.0

func (s *DayTimeInterval) IsValid() bool

func (*DayTimeInterval) Set added in v3.9.0

func (s *DayTimeInterval) Set(value any) error

func (*DayTimeInterval) String added in v3.9.0

func (s *DayTimeInterval) String() string

type Decimal128 added in v3.9.0

type Decimal128 struct {
	Valid bool
	Value decimal128.Num
	Type  *arrow.Decimal128Type // Stores precision and scale
}

func (*Decimal128) DataType added in v3.9.0

func (s *Decimal128) DataType() arrow.DataType

func (*Decimal128) Equal added in v3.9.0

func (s *Decimal128) Equal(rhs Scalar) bool

func (*Decimal128) Get added in v3.9.0

func (s *Decimal128) Get() any

func (*Decimal128) IsValid added in v3.9.0

func (s *Decimal128) IsValid() bool

func (*Decimal128) Set added in v3.9.0

func (s *Decimal128) Set(val any) error

func (*Decimal128) String added in v3.9.0

func (s *Decimal128) String() string

type Decimal256 added in v3.9.0

type Decimal256 struct {
	Valid bool
	Value decimal256.Num
	Type  *arrow.Decimal256Type // Stores precision and scale
}

func (*Decimal256) DataType added in v3.9.0

func (s *Decimal256) DataType() arrow.DataType

func (*Decimal256) Equal added in v3.9.0

func (s *Decimal256) Equal(rhs Scalar) bool

func (*Decimal256) Get added in v3.9.0

func (s *Decimal256) Get() any

func (*Decimal256) IsValid added in v3.9.0

func (s *Decimal256) IsValid() bool

func (*Decimal256) Set added in v3.9.0

func (s *Decimal256) Set(val any) error

func (*Decimal256) String added in v3.9.0

func (s *Decimal256) String() string

type Duration added in v3.9.0

type Duration struct {
	Int
	Unit arrow.TimeUnit
}

func (*Duration) DataType added in v3.9.0

func (s *Duration) DataType() arrow.DataType

func (*Duration) Equal added in v3.9.0

func (s *Duration) Equal(rhs Scalar) bool

func (*Duration) Set added in v3.9.0

func (s *Duration) Set(value any) error

func (*Duration) String added in v3.9.0

func (s *Duration) String() string

type Float added in v3.9.0

type Float struct {
	Valid    bool
	Value    float64
	BitWidth uint8 // defaults to 64
}

func (*Float) DataType added in v3.9.0

func (s *Float) DataType() arrow.DataType

func (*Float) Equal added in v3.9.0

func (s *Float) Equal(rhs Scalar) bool

func (*Float) Get added in v3.9.0

func (s *Float) Get() any

func (*Float) IsValid added in v3.9.0

func (s *Float) IsValid() bool

func (*Float) Set added in v3.9.0

func (s *Float) Set(val any) error

func (*Float) String added in v3.9.0

func (s *Float) String() string

type Inet

type Inet struct {
	Valid bool
	Value *net.IPNet
}

func (*Inet) DataType

func (*Inet) DataType() arrow.DataType

func (*Inet) Equal

func (s *Inet) Equal(rhs Scalar) bool

func (*Inet) Get added in v3.6.4

func (s *Inet) Get() any

func (*Inet) IsValid

func (s *Inet) IsValid() bool

func (*Inet) Set

func (s *Inet) Set(val any) error

func (*Inet) String

func (s *Inet) String() string

type Int added in v3.9.0

type Int struct {
	Valid    bool
	Value    int64
	BitWidth uint8 // defaults to 64
}

func (*Int) DataType added in v3.9.0

func (s *Int) DataType() arrow.DataType

func (*Int) Equal added in v3.9.0

func (s *Int) Equal(rhs Scalar) bool

func (*Int) Get added in v3.9.0

func (s *Int) Get() any

func (*Int) IsValid added in v3.9.0

func (s *Int) IsValid() bool

func (*Int) Set added in v3.9.0

func (s *Int) Set(val any) error

func (*Int) String added in v3.9.0

func (s *Int) String() string

type JSON

type JSON struct {
	Valid bool
	Value []byte
}

func (*JSON) DataType

func (*JSON) DataType() arrow.DataType

func (*JSON) Equal

func (s *JSON) Equal(rhs Scalar) bool

func (*JSON) Get added in v3.6.4

func (s *JSON) Get() any

func (*JSON) IsValid

func (s *JSON) IsValid() bool

func (*JSON) Set

func (s *JSON) Set(val any) error

func (*JSON) String

func (s *JSON) String() string

type LargeBinary

type LargeBinary struct {
	Binary
}

func (*LargeBinary) DataType

func (*LargeBinary) DataType() arrow.DataType

type LargeString

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

func (*LargeString) DataType

func (*LargeString) DataType() arrow.DataType

func (*LargeString) Equal added in v3.9.0

func (s *LargeString) Equal(rhs Scalar) bool

func (*LargeString) Get added in v3.9.0

func (s *LargeString) Get() any

func (*LargeString) IsValid added in v3.9.0

func (s *LargeString) IsValid() bool

func (*LargeString) Set added in v3.9.0

func (s *LargeString) Set(val any) error

func (*LargeString) String added in v3.9.0

func (s *LargeString) String() string

type List

type List struct {
	Valid bool
	Value Vector
	Type  arrow.DataType
}

func (*List) DataType

func (s *List) DataType() arrow.DataType

func (*List) Equal

func (s *List) Equal(rhs Scalar) bool

func (*List) Get added in v3.6.4

func (s *List) Get() any

func (*List) IsValid

func (s *List) IsValid() bool

func (*List) Set

func (s *List) Set(val any) error

func (*List) String

func (s *List) String() string

type Mac

type Mac struct {
	Valid bool
	Value net.HardwareAddr
}

func (*Mac) DataType

func (*Mac) DataType() arrow.DataType

func (*Mac) Equal

func (s *Mac) Equal(rhs Scalar) bool

func (*Mac) Get added in v3.6.4

func (s *Mac) Get() any

func (*Mac) IsValid

func (s *Mac) IsValid() bool

func (*Mac) Set

func (s *Mac) Set(val any) error

func (*Mac) String

func (s *Mac) String() string

type MonthDayNanoInterval added in v3.9.0

type MonthDayNanoInterval struct {
	Value arrow.MonthDayNanoInterval
	Valid bool
}

func (*MonthDayNanoInterval) DataType added in v3.9.0

func (*MonthDayNanoInterval) DataType() arrow.DataType

func (*MonthDayNanoInterval) Equal added in v3.9.0

func (s *MonthDayNanoInterval) Equal(rhs Scalar) bool

func (*MonthDayNanoInterval) Get added in v3.9.0

func (s *MonthDayNanoInterval) Get() any

func (*MonthDayNanoInterval) IsValid added in v3.9.0

func (s *MonthDayNanoInterval) IsValid() bool

func (*MonthDayNanoInterval) Set added in v3.9.0

func (s *MonthDayNanoInterval) Set(value any) error

func (*MonthDayNanoInterval) String added in v3.9.0

func (s *MonthDayNanoInterval) String() string

type MonthInterval added in v3.9.0

type MonthInterval struct {
	Int
}

func (*MonthInterval) DataType added in v3.9.0

func (*MonthInterval) DataType() arrow.DataType

func (*MonthInterval) Equal added in v3.9.0

func (s *MonthInterval) Equal(rhs Scalar) bool

func (*MonthInterval) Set added in v3.9.0

func (s *MonthInterval) Set(value any) error

func (*MonthInterval) String added in v3.9.0

func (s *MonthInterval) String() string

type Scalar

type Scalar interface {
	fmt.Stringer
	// IsValid returns true if the value is non-null, otherwise false.
	IsValid() bool
	// The datatype of the value in this scalar
	DataType() arrow.DataType
	// Performs cheap validation checks, returns nil if successful
	// Validate() error
	// tries to set the value of the scalar to the given value
	Set(val any) error

	Get() any
	Equal(other Scalar) bool
}

Scalar represents a single value of a specific DataType as opposed to an array.

Scalars are useful for passing single value inputs to compute functions (not yet implemented) or for representing individual array elements, (with a non-trivial cost though).

func NewScalar

func NewScalar(dt arrow.DataType) Scalar

type String

type String struct {
	Valid bool
	Value string
}

func (*String) DataType

func (*String) DataType() arrow.DataType

func (*String) Equal

func (s *String) Equal(rhs Scalar) bool

func (*String) Get added in v3.6.4

func (s *String) Get() any

func (*String) IsValid

func (s *String) IsValid() bool

func (*String) Set

func (s *String) Set(val any) error

func (*String) String

func (s *String) String() string

type Struct added in v3.9.0

type Struct struct {
	Valid bool
	Value any

	Type *arrow.StructType
}

func (*Struct) DataType added in v3.9.0

func (s *Struct) DataType() arrow.DataType

func (*Struct) Equal added in v3.9.0

func (s *Struct) Equal(rhs Scalar) bool

func (*Struct) Get added in v3.9.0

func (s *Struct) Get() any

func (*Struct) IsValid added in v3.9.0

func (s *Struct) IsValid() bool

func (*Struct) Set added in v3.9.0

func (s *Struct) Set(val any) error

func (*Struct) String added in v3.9.0

func (s *Struct) String() string

type Time added in v3.9.0

type Time struct {
	Int
	Unit arrow.TimeUnit
}

func (*Time) DataType added in v3.9.0

func (s *Time) DataType() arrow.DataType

func (*Time) Equal added in v3.9.0

func (s *Time) Equal(rhs Scalar) bool

func (*Time) Get added in v3.9.0

func (s *Time) Get() any

func (*Time) Set added in v3.9.0

func (s *Time) Set(value any) error

func (*Time) String added in v3.9.0

func (s *Time) String() string

type Timestamp

type Timestamp struct {
	Valid bool
	Value time.Time
	Type  *arrow.TimestampType
}

func (*Timestamp) DataType

func (s *Timestamp) DataType() arrow.DataType

func (*Timestamp) DecodeText

func (s *Timestamp) DecodeText(src []byte) error

func (*Timestamp) Equal

func (s *Timestamp) Equal(rhs Scalar) bool

func (*Timestamp) Get added in v3.6.4

func (s *Timestamp) Get() any

func (*Timestamp) IsValid

func (s *Timestamp) IsValid() bool

func (*Timestamp) Set

func (s *Timestamp) Set(val any) error

func (*Timestamp) String

func (s *Timestamp) String() string

type UUID

type UUID struct {
	Valid bool
	Value uuid.UUID
}

func (*UUID) DataType

func (*UUID) DataType() arrow.DataType

func (*UUID) Equal

func (s *UUID) Equal(rhs Scalar) bool

func (*UUID) Get added in v3.6.4

func (s *UUID) Get() any

func (*UUID) IsValid

func (s *UUID) IsValid() bool

func (*UUID) Set

func (s *UUID) Set(src any) error

func (*UUID) String

func (s *UUID) String() string

type Uint added in v3.9.0

type Uint struct {
	Valid    bool
	Value    uint64
	BitWidth uint8 // defaults to 64
}

func (*Uint) DataType added in v3.9.0

func (s *Uint) DataType() arrow.DataType

func (*Uint) Equal added in v3.9.0

func (s *Uint) Equal(rhs Scalar) bool

func (*Uint) Get added in v3.9.0

func (s *Uint) Get() any

func (*Uint) IsValid added in v3.9.0

func (s *Uint) IsValid() bool

func (*Uint) Set added in v3.9.0

func (s *Uint) Set(val any) error

func (*Uint) String added in v3.9.0

func (s *Uint) String() string

type ValidationError

type ValidationError struct {
	Err   error
	Msg   string
	Type  arrow.DataType
	Value any
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) MaskedError

func (e *ValidationError) MaskedError() string

this prints the error without the value

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

type Vector

type Vector []Scalar

func (Vector) Equal

func (v Vector) Equal(r Vector) bool

Jump to

Keyboard shortcuts

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