scalar

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MPL-2.0, MIT Imports: 15 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) 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) 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 Float32

type Float32 struct {
	Valid bool
	Value float32
}

func (*Float32) DataType

func (*Float32) DataType() arrow.DataType

func (*Float32) Equal

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

func (*Float32) IsValid

func (s *Float32) IsValid() bool

func (*Float32) Set

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

func (*Float32) String

func (s *Float32) String() string

type Float64

type Float64 struct {
	Valid bool
	Value float64
}

func (*Float64) DataType

func (*Float64) DataType() arrow.DataType

func (*Float64) Equal

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

func (*Float64) IsValid

func (s *Float64) IsValid() bool

func (*Float64) Set

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

func (*Float64) String

func (s *Float64) 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) 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 Int64

type Int64 struct {
	Valid bool
	Value int64
}

func (*Int64) DataType

func (*Int64) DataType() arrow.DataType

func (*Int64) Equal

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

func (*Int64) IsValid

func (s *Int64) IsValid() bool

func (*Int64) Set

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

func (*Int64) String

func (s *Int64) 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) 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

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

type Timestamp struct {
	Valid bool
	Value time.Time
}

func (*Timestamp) DataType

func (*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) 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) 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 Uint64

type Uint64 struct {
	Valid bool
	Value uint64
}

func (*Uint64) DataType

func (*Uint64) DataType() arrow.DataType

func (*Uint64) Equal

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

func (*Uint64) IsValid

func (s *Uint64) IsValid() bool

func (*Uint64) Set

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

func (*Uint64) String

func (s *Uint64) 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