types

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NullabilityUnspecified = proto.Type_NULLABILITY_UNSPECIFIED
	NullabilityNullable    = proto.Type_NULLABILITY_NULLABLE
	NullabilityRequired    = proto.Type_NULLABILITY_REQUIRED
)

Variables

View Source
var CommonEnumType = &EnumType{}

Functions

func AreSyncTypeParametersMatching added in v3.2.0

func AreSyncTypeParametersMatching(funcParameters []FuncDefArgType, argumentTypes []Type) bool

func GetShortTypeName

func GetShortTypeName(name TypeName) string

func GetTypeNameToTypeMap

func GetTypeNameToTypeMap() map[string]Type

func TypeToProto

func TypeToProto(t Type) *proto.Type

TypeToProto properly constructs the appropriate protobuf message for the given type.

Types

type AggregationPhase

type AggregationPhase = proto.AggregationPhase

type AnyType

type AnyType struct {
	Name             string
	TypeVariationRef uint32
	Nullability      Nullability
}

AnyType to represent AnyType, this type is to indicate "any" type of argument This type is not used in function invocation. It is only used in function definition

func (*AnyType) GetNullability

func (m *AnyType) GetNullability() Nullability

func (*AnyType) GetParameterizedParams

func (m *AnyType) GetParameterizedParams() []interface{}

func (*AnyType) HasParameterizedParam

func (m *AnyType) HasParameterizedParam() bool

func (*AnyType) MatchWithNullability

func (m *AnyType) MatchWithNullability(ot Type) bool

func (*AnyType) MatchWithoutNullability

func (m *AnyType) MatchWithoutNullability(ot Type) bool

func (*AnyType) ReturnType

func (m *AnyType) ReturnType(funcParameters []FuncDefArgType, argumentTypes []Type) (Type, error)

func (*AnyType) SetNullability

func (m *AnyType) SetNullability(n Nullability) FuncDefArgType

func (*AnyType) ShortString

func (m *AnyType) ShortString() string

func (*AnyType) String

func (m *AnyType) String() string

func (*AnyType) WithParameters

func (m *AnyType) WithParameters([]interface{}) (Type, error)

type Assignment

type Assignment struct {
	Name  string
	Value Expr
}

func (Assignment) Evaluate

func (a Assignment) Evaluate(symbolTable map[string]any) error

func (Assignment) String

func (a Assignment) String() string

type BinaryExpr

type BinaryExpr struct {
	Op    BinaryOp
	Left  Expr
	Right Expr
}

func (BinaryExpr) Evaluate

func (b BinaryExpr) Evaluate(symbolTable map[string]any) (any, error)

func (BinaryExpr) String

func (b BinaryExpr) String() string

type BinaryOp

type BinaryOp int
const (
	Unknown BinaryOp = iota
	And
	Or
	Plus
	Minus
	Multiply
	Divide
	LT
	LTE
	GT
	GTE
	EQ
	NEQ
)

func GetBinaryOpType

func GetBinaryOpType(op string) BinaryOp

func (BinaryOp) String

func (b BinaryOp) String() string

type BinaryType

type BinaryType = PrimitiveType[[]byte]

create type aliases to the generic structs

type BooleanParameter

type BooleanParameter bool

BooleanParameter is a type parameter like <true> for a type.

func (BooleanParameter) Equals

func (b BooleanParameter) Equals(p TypeParam) bool

func (BooleanParameter) ToProto

func (b BooleanParameter) ToProto() *proto.Type_Parameter

type BooleanType

type BooleanType = PrimitiveType[bool]

create type aliases to the generic structs

type CompositeType

type CompositeType interface {
	Type
	// ParameterString this returns parameter string
	// for e.g. parameter decimal<P, S>, ParameterString returns "P,S"
	ParameterString() string
	// BaseString this returns long name for parameter string
	// for e.g. parameter decimal<P, S>, BaseString returns "decimal"
	BaseString() string
}

CompositeType this represents a concrete type having components

type DataTypeParameter

type DataTypeParameter struct {
	Type
}

DataTypeParameter is like the i32 in LIST<i32>

func (*DataTypeParameter) Equals

func (d *DataTypeParameter) Equals(p TypeParam) bool

func (*DataTypeParameter) ToProto

func (d *DataTypeParameter) ToProto() *proto.Type_Parameter

type DataTypeUDTParam

type DataTypeUDTParam struct {
	Type FuncDefArgType
}

func (*DataTypeUDTParam) MatchWithNullability

func (d *DataTypeUDTParam) MatchWithNullability(param TypeParam) bool

func (*DataTypeUDTParam) MatchWithoutNullability

func (d *DataTypeUDTParam) MatchWithoutNullability(param TypeParam) bool

func (*DataTypeUDTParam) String

func (d *DataTypeUDTParam) String() string

type Date

type Date int32

type DateType

type DateType = PrimitiveType[Date]

create type aliases to the generic structs

type DecimalType

type DecimalType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Scale, Precision int32
}

DecimalType is a decimal type with concrete precision and scale parameters, e.g. Decimal(10, 2).

func (*DecimalType) BaseString

func (*DecimalType) BaseString() string

func (*DecimalType) Equals

func (s *DecimalType) Equals(rhs Type) bool

func (*DecimalType) GetNullability

func (s *DecimalType) GetNullability() Nullability

func (*DecimalType) GetParameters

func (s *DecimalType) GetParameters() []interface{}

func (*DecimalType) GetType

func (s *DecimalType) GetType() Type

func (*DecimalType) GetTypeVariationReference

func (s *DecimalType) GetTypeVariationReference() uint32

func (*DecimalType) ParameterString

func (s *DecimalType) ParameterString() string

func (*DecimalType) ShortString

func (*DecimalType) ShortString() string

func (*DecimalType) String

func (s *DecimalType) String() string

func (*DecimalType) ToProto

func (s *DecimalType) ToProto() *proto.Type

func (*DecimalType) ToProtoFuncArg

func (s *DecimalType) ToProtoFuncArg() *proto.FunctionArgument

func (*DecimalType) WithNullability

func (s *DecimalType) WithNullability(n Nullability) Type

type Enum

type Enum string

func (Enum) String

func (e Enum) String() string

func (Enum) ToProtoFuncArg

func (e Enum) ToProtoFuncArg() *proto.FunctionArgument

type EnumParameter

type EnumParameter string

EnumParameter is a type parameter that is some enum value

func (EnumParameter) Equals

func (b EnumParameter) Equals(p TypeParam) bool

func (EnumParameter) ToProto

func (p EnumParameter) ToProto() *proto.Type_Parameter

type EnumType

type EnumType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Name             string
	Options          []string
}

EnumType represents an enumeration function parameter. It supports a fixed set of declared string values as constant arguments.

func (*EnumType) Equals

func (e *EnumType) Equals(t Type) bool

func (*EnumType) GetNullability

func (e *EnumType) GetNullability() Nullability

func (*EnumType) GetParameterizedParams

func (e *EnumType) GetParameterizedParams() []interface{}

func (*EnumType) GetParameters

func (e *EnumType) GetParameters() []interface{}

func (*EnumType) GetType

func (e *EnumType) GetType() Type

func (*EnumType) GetTypeVariationReference

func (e *EnumType) GetTypeVariationReference() uint32

func (*EnumType) HasParameterizedParam

func (e *EnumType) HasParameterizedParam() bool

func (*EnumType) MatchWithNullability

func (e *EnumType) MatchWithNullability(ot Type) bool

func (*EnumType) MatchWithoutNullability

func (e *EnumType) MatchWithoutNullability(ot Type) bool

func (*EnumType) ReturnType

func (e *EnumType) ReturnType(funcParameters []FuncDefArgType, argumentTypes []Type) (Type, error)

func (*EnumType) SetNullability

func (e *EnumType) SetNullability(n Nullability) FuncDefArgType

func (*EnumType) ShortString

func (e *EnumType) ShortString() string

func (*EnumType) String

func (e *EnumType) String() string

func (*EnumType) ToProtoFuncArg

func (e *EnumType) ToProtoFuncArg() *proto.FunctionArgument

func (*EnumType) WithNullability

func (e *EnumType) WithNullability(n Nullability) Type

func (*EnumType) WithParameters

func (e *EnumType) WithParameters(params []interface{}) (Type, error)

type Expr

type Expr interface {
	Evaluate(symbolTable map[string]any) (any, error)
	String() string
}

type FixedBinary

type FixedBinary []byte

type FixedBinaryType

type FixedBinaryType = FixedLenType[FixedBinary]

create type aliases to the generic structs

type FixedChar

type FixedChar string

type FixedCharType

type FixedCharType = FixedLenType[FixedChar]

create type aliases to the generic structs

type FixedLenType

type FixedLenType[T FixedChar | VarChar | FixedBinary] struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Length           int32
}

FixedLenType is any of the types which also need to track their specific length as they have a fixed length.

func (*FixedLenType[T]) BaseString

func (s *FixedLenType[T]) BaseString() string

func (*FixedLenType[T]) Equals

func (s *FixedLenType[T]) Equals(rhs Type) bool

func (*FixedLenType[T]) GetLength

func (s *FixedLenType[T]) GetLength() int32

func (*FixedLenType[T]) GetNullability

func (s *FixedLenType[T]) GetNullability() Nullability

func (*FixedLenType[T]) GetParameters

func (s *FixedLenType[T]) GetParameters() []interface{}

func (*FixedLenType[T]) GetReturnType

func (s *FixedLenType[T]) GetReturnType(length int32, nullability Nullability) Type

func (*FixedLenType[T]) GetType

func (s *FixedLenType[T]) GetType() Type

func (*FixedLenType[T]) GetTypeVariationReference

func (s *FixedLenType[T]) GetTypeVariationReference() uint32

func (*FixedLenType[T]) ParameterString

func (s *FixedLenType[T]) ParameterString() string

func (*FixedLenType[T]) ShortString

func (*FixedLenType[T]) ShortString() string

func (*FixedLenType[T]) String

func (s *FixedLenType[T]) String() string

func (*FixedLenType[T]) ToProtoFuncArg

func (s *FixedLenType[T]) ToProtoFuncArg() *proto.FunctionArgument

func (*FixedLenType[T]) WithLength

func (s *FixedLenType[T]) WithLength(length int32) FixedType

func (*FixedLenType[T]) WithNullability

func (s *FixedLenType[T]) WithNullability(n Nullability) Type

type FixedType

type FixedType interface {
	CompositeType
	WithLength(int32) FixedType
	GetLength() int32
}

func FixedTypeNameToType

func FixedTypeNameToType(name TypeName) (FixedType, error)

type Float32Type

type Float32Type = PrimitiveType[float32]

create type aliases to the generic structs

type Float64Type

type Float64Type = PrimitiveType[float64]

create type aliases to the generic structs

type FuncArg

type FuncArg interface {
	fmt.Stringer
	ToProtoFuncArg() *proto.FunctionArgument
}

FuncArg corresponds to the protobuf FunctionArgument. Anything which could be a function argument should meet this interface. This is either an Expression, a Type, or an Enum (string).

type FuncDefArgType

type FuncDefArgType interface {
	fmt.Stringer
	//SetNullability set nullability as given argument
	SetNullability(Nullability) FuncDefArgType
	// HasParameterizedParam returns true if the type has at least one parameterized parameters
	// if all parameters are concrete then it returns false
	HasParameterizedParam() bool
	// GetParameterizedParams returns all parameterized parameters
	// it doesn't return concrete parameters
	GetParameterizedParams() []interface{}

	// MatchWithNullability This API return true if Type argument
	// is compatible with this param otherwise it returns false.
	// This method expects that nullability of argument is same as this type.
	MatchWithNullability(ot Type) bool
	// MatchWithoutNullability This API return true if Type argument
	// is compatible with this param otherwise it returns false.
	// This method ignores nullability for matching.
	MatchWithoutNullability(ot Type) bool
	ShortString() string
	GetNullability() Nullability
	ReturnType(funcParameters []FuncDefArgType, argumentTypes []Type) (Type, error)

	// WithParameters returns a new instance of this type with the given parameters.
	// This is used in function return type derivation
	WithParameters([]interface{}) (Type, error)
}

FuncDefArgType this represents a type used in function argument These type can't be present in plan (not serializable)

type FunctionCallExpr

type FunctionCallExpr struct {
	Name string
	Args []Expr
}

func (FunctionCallExpr) Evaluate

func (f FunctionCallExpr) Evaluate(symbolTable map[string]any) (any, error)

func (FunctionCallExpr) String

func (f FunctionCallExpr) String() string

type FunctionOption

type FunctionOption = proto.FunctionOption

type FunctionRef

type FunctionRef uint32

func (FunctionRef) String

func (f FunctionRef) String() string

type IfExpr

type IfExpr struct {
	Condition Expr
	Then      Expr
	Else      Expr
	IsTernary bool
}

func (IfExpr) Evaluate

func (i IfExpr) Evaluate(symbolTable map[string]any) (any, error)

func (IfExpr) String

func (i IfExpr) String() string

type Int16Type

type Int16Type = PrimitiveType[int16]

create type aliases to the generic structs

type Int32Type

type Int32Type = PrimitiveType[int32]

create type aliases to the generic structs

type Int64Type

type Int64Type = PrimitiveType[int64]

create type aliases to the generic structs

type Int8Type

type Int8Type = PrimitiveType[int8]

create type aliases to the generic structs

type IntegerParameter

type IntegerParameter int64

IntegerParameter is the type parameter like 10 in VARCHAR<10>

func (IntegerParameter) Equals

func (b IntegerParameter) Equals(p TypeParam) bool

func (IntegerParameter) ToProto

func (p IntegerParameter) ToProto() *proto.Type_Parameter

type IntegerUDTParam

type IntegerUDTParam struct {
	Integer int32
}

func (*IntegerUDTParam) MatchWithNullability

func (i *IntegerUDTParam) MatchWithNullability(param TypeParam) bool

func (*IntegerUDTParam) MatchWithoutNullability

func (i *IntegerUDTParam) MatchWithoutNullability(param TypeParam) bool

func (*IntegerUDTParam) String

func (i *IntegerUDTParam) String() string

type IntervalCompoundType

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

IntervalCompoundType this is used to represent a type of interval compound.

func NewIntervalCompoundType

func NewIntervalCompoundType() IntervalCompoundType

NewIntervalCompoundType creates a type of new interval compound.

func (IntervalCompoundType) Equals

func (m IntervalCompoundType) Equals(rhs Type) bool

func (IntervalCompoundType) GetNullability

func (m IntervalCompoundType) GetNullability() Nullability

func (IntervalCompoundType) GetParameters

func (m IntervalCompoundType) GetParameters() []interface{}

func (IntervalCompoundType) GetPrecisionProtoVal

func (m IntervalCompoundType) GetPrecisionProtoVal() int32

func (IntervalCompoundType) GetType

func (m IntervalCompoundType) GetType() Type

func (IntervalCompoundType) GetTypeVariationReference

func (m IntervalCompoundType) GetTypeVariationReference() uint32

func (IntervalCompoundType) ShortString

func (IntervalCompoundType) ShortString() string

func (IntervalCompoundType) String

func (m IntervalCompoundType) String() string

func (IntervalCompoundType) ToProto

func (m IntervalCompoundType) ToProto() *proto.Type

func (IntervalCompoundType) ToProtoFuncArg

func (m IntervalCompoundType) ToProtoFuncArg() *proto.FunctionArgument

func (IntervalCompoundType) WithNullability

func (m IntervalCompoundType) WithNullability(n Nullability) Type

func (IntervalCompoundType) WithPrecision

func (m IntervalCompoundType) WithPrecision(precision TimePrecision) IntervalCompoundType

func (IntervalCompoundType) WithTypeVariationRef

func (m IntervalCompoundType) WithTypeVariationRef(typeVariationRef uint32) IntervalCompoundType

type IntervalDayType

type IntervalDayType struct {
	Precision        TimePrecision
	TypeVariationRef uint32
	Nullability      Nullability
}

IntervalDayType this is used to represent a type of interval day.

func (*IntervalDayType) BaseString

func (s *IntervalDayType) BaseString() string

func (*IntervalDayType) Equals

func (m *IntervalDayType) Equals(rhs Type) bool

func (*IntervalDayType) GetNullability

func (m *IntervalDayType) GetNullability() Nullability

func (*IntervalDayType) GetParameters

func (m *IntervalDayType) GetParameters() []interface{}

func (*IntervalDayType) GetPrecision

func (m *IntervalDayType) GetPrecision() TimePrecision

func (*IntervalDayType) GetPrecisionProtoVal

func (m *IntervalDayType) GetPrecisionProtoVal() int32

func (*IntervalDayType) GetReturnType

func (m *IntervalDayType) GetReturnType(length int32, nullability Nullability) Type

func (*IntervalDayType) GetType

func (m *IntervalDayType) GetType() Type

func (*IntervalDayType) GetTypeVariationReference

func (m *IntervalDayType) GetTypeVariationReference() uint32

func (*IntervalDayType) ParameterString

func (m *IntervalDayType) ParameterString() string

func (*IntervalDayType) ShortString

func (*IntervalDayType) ShortString() string

func (*IntervalDayType) String

func (m *IntervalDayType) String() string

func (*IntervalDayType) ToProto

func (m *IntervalDayType) ToProto() *proto.Type

func (*IntervalDayType) ToProtoFuncArg

func (m *IntervalDayType) ToProtoFuncArg() *proto.FunctionArgument

func (*IntervalDayType) WithNullability

func (m *IntervalDayType) WithNullability(n Nullability) Type

type IntervalYearToMonthType

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

IntervalYearToMonthType this is used to represent a type of interval which represents YearToMonth.

func NewIntervalYearToMonthType

func NewIntervalYearToMonthType() IntervalYearToMonthType

NewIntervalYearToMonthType creates a type of new interval YearToMonth. Created type has nullability as Nullable

func (IntervalYearToMonthType) Equals

func (m IntervalYearToMonthType) Equals(rhs Type) bool

func (IntervalYearToMonthType) GetNullability

func (m IntervalYearToMonthType) GetNullability() Nullability

func (IntervalYearToMonthType) GetParameters

func (m IntervalYearToMonthType) GetParameters() []interface{}

func (IntervalYearToMonthType) GetType

func (m IntervalYearToMonthType) GetType() Type

func (IntervalYearToMonthType) GetTypeVariationReference

func (m IntervalYearToMonthType) GetTypeVariationReference() uint32

func (IntervalYearToMonthType) ShortString

func (IntervalYearToMonthType) ShortString() string

func (IntervalYearToMonthType) String

func (m IntervalYearToMonthType) String() string

func (IntervalYearToMonthType) ToProto

func (m IntervalYearToMonthType) ToProto() *proto.Type

func (IntervalYearToMonthType) ToProtoFuncArg

func (m IntervalYearToMonthType) ToProtoFuncArg() *proto.FunctionArgument

func (IntervalYearToMonthType) WithNullability

func (m IntervalYearToMonthType) WithNullability(n Nullability) Type

func (IntervalYearToMonthType) WithTypeVariationRef

func (m IntervalYearToMonthType) WithTypeVariationRef(typeVariationRef uint32) IntervalYearToMonthType

type IntervalYearType

type IntervalYearType = PrimitiveType[IntervalYearToMonth]

create type aliases to the generic structs

type ListType

type ListType struct {
	Nullability      Nullability
	TypeVariationRef uint32

	Type Type
}

func (*ListType) BaseString

func (*ListType) BaseString() string

func (*ListType) Equals

func (t *ListType) Equals(rhs Type) bool

func (*ListType) GetNullability

func (s *ListType) GetNullability() Nullability

func (*ListType) GetParameters

func (s *ListType) GetParameters() []interface{}

func (*ListType) GetType

func (s *ListType) GetType() Type

func (*ListType) GetTypeVariationReference

func (s *ListType) GetTypeVariationReference() uint32

func (*ListType) ParameterString

func (s *ListType) ParameterString() string

func (*ListType) ShortString

func (*ListType) ShortString() string

func (*ListType) String

func (t *ListType) String() string

func (*ListType) ToProto

func (t *ListType) ToProto() *proto.Type

func (*ListType) ToProtoFuncArg

func (t *ListType) ToProtoFuncArg() *proto.FunctionArgument

func (*ListType) WithNullability

func (s *ListType) WithNullability(n Nullability) Type

type LiteralNumber

type LiteralNumber struct {
	Value int64
}

func (*LiteralNumber) Evaluate

func (l *LiteralNumber) Evaluate(map[string]any) (any, error)

func (*LiteralNumber) String

func (l *LiteralNumber) String() string

type MapType

type MapType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Key, Value       Type
}

func (*MapType) BaseString

func (*MapType) BaseString() string

func (*MapType) Equals

func (t *MapType) Equals(rhs Type) bool

func (*MapType) GetNullability

func (s *MapType) GetNullability() Nullability

func (*MapType) GetParameters

func (s *MapType) GetParameters() []interface{}

func (*MapType) GetType

func (s *MapType) GetType() Type

func (*MapType) GetTypeVariationReference

func (s *MapType) GetTypeVariationReference() uint32

func (*MapType) ParameterString

func (t *MapType) ParameterString() string

func (*MapType) ShortString

func (t *MapType) ShortString() string

func (*MapType) String

func (t *MapType) String() string

func (*MapType) ToProto

func (t *MapType) ToProto() *proto.Type

func (*MapType) ToProtoFuncArg

func (t *MapType) ToProtoFuncArg() *proto.FunctionArgument

func (*MapType) WithNullability

func (s *MapType) WithNullability(n Nullability) Type

type NamedStruct

type NamedStruct struct {
	Names  []string
	Struct StructType
}

func NewNamedStructFromProto

func NewNamedStructFromProto(n *proto.NamedStruct) NamedStruct

func (NamedStruct) String

func (n NamedStruct) String() string

func (NamedStruct) ToProto

func (n NamedStruct) ToProto() *proto.NamedStruct

type NotExpr

type NotExpr struct {
	Expr Expr
}

func (NotExpr) Evaluate

func (n NotExpr) Evaluate(symbolTable map[string]any) (any, error)

func (NotExpr) String

func (n NotExpr) String() string

type NullParameter

type NullParameter struct{}

NullParameter is an explicitly null/unspecified parameter, to select the default value (if any).

func (NullParameter) Equals

func (NullParameter) Equals(p TypeParam) bool

func (NullParameter) ToProto

func (NullParameter) ToProto() *proto.Type_Parameter

type Nullability

type Nullability = proto.Type_Nullability

type OutputDerivation

type OutputDerivation struct {
	Assignments []Assignment
	FinalType   FuncDefArgType
}

func (*OutputDerivation) GetNullability

func (m *OutputDerivation) GetNullability() Nullability

func (*OutputDerivation) GetParameterizedParams

func (m *OutputDerivation) GetParameterizedParams() []interface{}

func (*OutputDerivation) HasParameterizedParam

func (m *OutputDerivation) HasParameterizedParam() bool

func (*OutputDerivation) MatchWithNullability

func (m *OutputDerivation) MatchWithNullability(ot Type) bool

func (*OutputDerivation) MatchWithoutNullability

func (m *OutputDerivation) MatchWithoutNullability(ot Type) bool

func (*OutputDerivation) ReturnType

func (m *OutputDerivation) ReturnType(funcParameters []FuncDefArgType, argumentTypes []Type) (Type, error)

func (*OutputDerivation) SetNullability

func (m *OutputDerivation) SetNullability(n Nullability) FuncDefArgType

func (*OutputDerivation) ShortString

func (m *OutputDerivation) ShortString() string

func (*OutputDerivation) String

func (m *OutputDerivation) String() string

func (*OutputDerivation) WithParameters

func (m *OutputDerivation) WithParameters([]interface{}) (Type, error)

type ParameterizedDecimalType

type ParameterizedDecimalType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Precision        integer_parameters.IntegerParameter
	Scale            integer_parameters.IntegerParameter
}

ParameterizedDecimalType is a decimal type which to hold function arguments example: Decimal<P,S> or Decimal<P,0> or Decimal(10, 2)

func (*ParameterizedDecimalType) GetNullability

func (m *ParameterizedDecimalType) GetNullability() Nullability

func (*ParameterizedDecimalType) GetParameterizedParams

func (m *ParameterizedDecimalType) GetParameterizedParams() []interface{}

func (*ParameterizedDecimalType) HasParameterizedParam

func (m *ParameterizedDecimalType) HasParameterizedParam() bool

func (*ParameterizedDecimalType) MatchWithNullability

func (m *ParameterizedDecimalType) MatchWithNullability(ot Type) bool

func (*ParameterizedDecimalType) MatchWithoutNullability

func (m *ParameterizedDecimalType) MatchWithoutNullability(ot Type) bool

func (*ParameterizedDecimalType) ReturnType

func (m *ParameterizedDecimalType) ReturnType(parameters []FuncDefArgType, argumentTypes []Type) (Type, error)

func (*ParameterizedDecimalType) SetNullability

func (*ParameterizedDecimalType) ShortString

func (m *ParameterizedDecimalType) ShortString() string

func (*ParameterizedDecimalType) String

func (m *ParameterizedDecimalType) String() string

func (*ParameterizedDecimalType) WithParameters

func (m *ParameterizedDecimalType) WithParameters(params []interface{}) (Type, error)

type ParameterizedFixedBinaryType

type ParameterizedFixedBinaryType = parameterizedTypeSingleIntegerParam[*FixedBinaryType]

create type aliases to the generic structs

type ParameterizedFixedCharType

type ParameterizedFixedCharType = parameterizedTypeSingleIntegerParam[*FixedCharType]

create type aliases to the generic structs

type ParameterizedIntervalDayType

type ParameterizedIntervalDayType = parameterizedTypeSingleIntegerParam[*IntervalDayType]

create type aliases to the generic structs

type ParameterizedListType

type ParameterizedListType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Type             FuncDefArgType
}

ParameterizedListType is a list type having parameter of ParameterizedAbstractType basically a list of which type is another abstract parameter example: List<Decimal(P,S)>. Kindly note concrete types List<Decimal(38, 0)> is not represented by this type Concrete type is represented by ListType

func (*ParameterizedListType) GetNullability

func (m *ParameterizedListType) GetNullability() Nullability

func (*ParameterizedListType) GetParameterizedParams

func (m *ParameterizedListType) GetParameterizedParams() []interface{}

func (*ParameterizedListType) HasParameterizedParam

func (m *ParameterizedListType) HasParameterizedParam() bool

func (*ParameterizedListType) MatchWithNullability

func (m *ParameterizedListType) MatchWithNullability(ot Type) bool

func (*ParameterizedListType) MatchWithoutNullability

func (m *ParameterizedListType) MatchWithoutNullability(ot Type) bool

func (*ParameterizedListType) ReturnType

func (m *ParameterizedListType) ReturnType([]FuncDefArgType, []Type) (Type, error)

func (*ParameterizedListType) SetNullability

func (m *ParameterizedListType) SetNullability(n Nullability) FuncDefArgType

func (*ParameterizedListType) ShortString

func (m *ParameterizedListType) ShortString() string

func (*ParameterizedListType) String

func (m *ParameterizedListType) String() string

func (*ParameterizedListType) WithParameters

func (m *ParameterizedListType) WithParameters(params []interface{}) (Type, error)

type ParameterizedMapType

type ParameterizedMapType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Key              FuncDefArgType
	Value            FuncDefArgType
}

ParameterizedMapType is a struct having at least one of key or value of type ParameterizedAbstractType If All arguments are concrete they are represented by MapType

func (*ParameterizedMapType) GetNullability

func (m *ParameterizedMapType) GetNullability() Nullability

func (*ParameterizedMapType) GetParameterizedParams

func (m *ParameterizedMapType) GetParameterizedParams() []interface{}

func (*ParameterizedMapType) HasParameterizedParam

func (m *ParameterizedMapType) HasParameterizedParam() bool

func (*ParameterizedMapType) MatchWithNullability

func (m *ParameterizedMapType) MatchWithNullability(ot Type) bool

func (*ParameterizedMapType) MatchWithoutNullability

func (m *ParameterizedMapType) MatchWithoutNullability(ot Type) bool

func (*ParameterizedMapType) ReturnType

func (m *ParameterizedMapType) ReturnType([]FuncDefArgType, []Type) (Type, error)

func (*ParameterizedMapType) SetNullability

func (m *ParameterizedMapType) SetNullability(n Nullability) FuncDefArgType

func (*ParameterizedMapType) ShortString

func (m *ParameterizedMapType) ShortString() string

func (*ParameterizedMapType) String

func (m *ParameterizedMapType) String() string

func (*ParameterizedMapType) WithParameters

func (m *ParameterizedMapType) WithParameters(params []interface{}) (Type, error)

type ParameterizedPrecisionTimestampType

type ParameterizedPrecisionTimestampType = parameterizedTypeSingleIntegerParam[*PrecisionTimestampType]

create type aliases to the generic structs

type ParameterizedPrecisionTimestampTzType

type ParameterizedPrecisionTimestampTzType = parameterizedTypeSingleIntegerParam[*PrecisionTimestampTzType]

create type aliases to the generic structs

type ParameterizedStructType

type ParameterizedStructType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Types            []FuncDefArgType
}

ParameterizedStructType is a parameter type struct example: Struct<Decimal(P,S), INT8> or Struct<INT8>.

func (*ParameterizedStructType) GetNullability

func (m *ParameterizedStructType) GetNullability() Nullability

func (*ParameterizedStructType) GetParameterizedParams

func (m *ParameterizedStructType) GetParameterizedParams() []interface{}

func (*ParameterizedStructType) HasParameterizedParam

func (m *ParameterizedStructType) HasParameterizedParam() bool

func (*ParameterizedStructType) MatchWithNullability

func (m *ParameterizedStructType) MatchWithNullability(ot Type) bool

func (*ParameterizedStructType) MatchWithoutNullability

func (m *ParameterizedStructType) MatchWithoutNullability(ot Type) bool

func (*ParameterizedStructType) ReturnType

func (m *ParameterizedStructType) ReturnType([]FuncDefArgType, []Type) (Type, error)

func (*ParameterizedStructType) SetNullability

func (m *ParameterizedStructType) SetNullability(n Nullability) FuncDefArgType

func (*ParameterizedStructType) ShortString

func (m *ParameterizedStructType) ShortString() string

func (*ParameterizedStructType) String

func (m *ParameterizedStructType) String() string

func (*ParameterizedStructType) WithParameters

func (m *ParameterizedStructType) WithParameters(params []interface{}) (Type, error)

type ParameterizedUserDefinedType

type ParameterizedUserDefinedType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	TypeParameters   []UDTParameter
	Name             string
}

ParameterizedUserDefinedType is a parameter type struct example: U!point<Decimal(P,S), DECIMAL(P,S)> or U!square<INT8>.

func (*ParameterizedUserDefinedType) GetNullability

func (m *ParameterizedUserDefinedType) GetNullability() Nullability

func (*ParameterizedUserDefinedType) GetParameterizedParams

func (m *ParameterizedUserDefinedType) GetParameterizedParams() []interface{}

func (*ParameterizedUserDefinedType) HasParameterizedParam

func (m *ParameterizedUserDefinedType) HasParameterizedParam() bool

func (*ParameterizedUserDefinedType) MatchWithNullability

func (m *ParameterizedUserDefinedType) MatchWithNullability(ot Type) bool

func (*ParameterizedUserDefinedType) MatchWithoutNullability

func (m *ParameterizedUserDefinedType) MatchWithoutNullability(ot Type) bool

func (*ParameterizedUserDefinedType) ReturnType

func (*ParameterizedUserDefinedType) SetNullability

func (*ParameterizedUserDefinedType) ShortString

func (m *ParameterizedUserDefinedType) ShortString() string

func (*ParameterizedUserDefinedType) String

func (*ParameterizedUserDefinedType) WithParameters

func (m *ParameterizedUserDefinedType) WithParameters(params []interface{}) (Type, error)

type ParameterizedVarCharType

type ParameterizedVarCharType = parameterizedTypeSingleIntegerParam[*VarCharType]

create type aliases to the generic structs

type PrecisionTimestampType

type PrecisionTimestampType struct {
	Precision        TimePrecision
	TypeVariationRef uint32
	Nullability      Nullability
}

PrecisionTimestampType this is used to represent a type of Precision timestamp

func NewPrecisionTimestampType

func NewPrecisionTimestampType(precision TimePrecision) *PrecisionTimestampType

NewPrecisionTimestampType creates a type of new Precision timestamp. Created type has Nullability as Nullable

func (*PrecisionTimestampType) BaseString

func (m *PrecisionTimestampType) BaseString() string

func (*PrecisionTimestampType) Equals

func (m *PrecisionTimestampType) Equals(rhs Type) bool

func (*PrecisionTimestampType) GetNullability

func (m *PrecisionTimestampType) GetNullability() Nullability

func (*PrecisionTimestampType) GetParameters

func (m *PrecisionTimestampType) GetParameters() []interface{}

func (*PrecisionTimestampType) GetPrecision

func (m *PrecisionTimestampType) GetPrecision() TimePrecision

func (*PrecisionTimestampType) GetPrecisionProtoVal

func (m *PrecisionTimestampType) GetPrecisionProtoVal() int32

func (*PrecisionTimestampType) GetReturnType

func (m *PrecisionTimestampType) GetReturnType(length int32, nullability Nullability) Type

func (*PrecisionTimestampType) GetType

func (m *PrecisionTimestampType) GetType() Type

func (*PrecisionTimestampType) GetTypeVariationReference

func (m *PrecisionTimestampType) GetTypeVariationReference() uint32

func (*PrecisionTimestampType) ParameterString

func (m *PrecisionTimestampType) ParameterString() string

func (*PrecisionTimestampType) ShortString

func (*PrecisionTimestampType) ShortString() string

func (*PrecisionTimestampType) String

func (m *PrecisionTimestampType) String() string

func (*PrecisionTimestampType) ToProto

func (m *PrecisionTimestampType) ToProto() *proto.Type

func (*PrecisionTimestampType) ToProtoFuncArg

func (m *PrecisionTimestampType) ToProtoFuncArg() *proto.FunctionArgument

func (*PrecisionTimestampType) WithNullability

func (m *PrecisionTimestampType) WithNullability(n Nullability) Type

type PrecisionTimestampTzType

type PrecisionTimestampTzType struct {
	PrecisionTimestampType
}

PrecisionTimestampTzType this is used to represent a type of Precision timestamp with TimeZone

func NewPrecisionTimestampTzType

func NewPrecisionTimestampTzType(precision TimePrecision) *PrecisionTimestampTzType

NewPrecisionTimestampTzType creates a type of new Precision timestamp with TimeZone. Created type has Nullability as Nullable

func (*PrecisionTimestampTzType) BaseString

func (m *PrecisionTimestampTzType) BaseString() string

func (*PrecisionTimestampTzType) Equals

func (m *PrecisionTimestampTzType) Equals(rhs Type) bool

func (*PrecisionTimestampTzType) GetNullability

func (m *PrecisionTimestampTzType) GetNullability() Nullability

func (*PrecisionTimestampTzType) GetParameters

func (m *PrecisionTimestampTzType) GetParameters() []interface{}

func (*PrecisionTimestampTzType) GetReturnType

func (m *PrecisionTimestampTzType) GetReturnType(length int32, nullability Nullability) Type

func (*PrecisionTimestampTzType) ShortString

func (*PrecisionTimestampTzType) ShortString() string

func (*PrecisionTimestampTzType) String

func (m *PrecisionTimestampTzType) String() string

func (*PrecisionTimestampTzType) ToProto

func (m *PrecisionTimestampTzType) ToProto() *proto.Type

func (*PrecisionTimestampTzType) ToProtoFuncArg

func (m *PrecisionTimestampTzType) ToProtoFuncArg() *proto.FunctionArgument

func (*PrecisionTimestampTzType) WithNullability

func (m *PrecisionTimestampTzType) WithNullability(n Nullability) Type

type PrimitiveType

type PrimitiveType[T primitiveTypeIFace] struct {
	Nullability      Nullability
	TypeVariationRef uint32
}

PrimitiveType is a generic implementation of simple primitive types which only need to track if they are nullable and if they are a type variation.

func (*PrimitiveType[T]) Equals

func (s *PrimitiveType[T]) Equals(rhs Type) bool

func (*PrimitiveType[T]) GetNullability

func (s *PrimitiveType[T]) GetNullability() Nullability

func (*PrimitiveType[T]) GetParameterizedParams

func (s *PrimitiveType[T]) GetParameterizedParams() []interface{}

func (*PrimitiveType[T]) GetParameters

func (s *PrimitiveType[T]) GetParameters() []interface{}

func (*PrimitiveType[T]) GetType

func (s *PrimitiveType[T]) GetType() Type

func (*PrimitiveType[T]) GetTypeVariationReference

func (s *PrimitiveType[T]) GetTypeVariationReference() uint32

func (*PrimitiveType[T]) HasParameterizedParam

func (s *PrimitiveType[T]) HasParameterizedParam() bool

func (*PrimitiveType[T]) MatchWithNullability

func (s *PrimitiveType[T]) MatchWithNullability(ot Type) bool

func (*PrimitiveType[T]) MatchWithoutNullability

func (s *PrimitiveType[T]) MatchWithoutNullability(ot Type) bool

func (*PrimitiveType[T]) ReturnType

func (s *PrimitiveType[T]) ReturnType([]FuncDefArgType, []Type) (Type, error)

func (*PrimitiveType[T]) SetNullability

func (s *PrimitiveType[T]) SetNullability(n Nullability) FuncDefArgType

func (*PrimitiveType[T]) ShortString

func (*PrimitiveType[T]) ShortString() string

func (*PrimitiveType[T]) String

func (s *PrimitiveType[T]) String() string

func (*PrimitiveType[T]) ToProtoFuncArg

func (s *PrimitiveType[T]) ToProtoFuncArg() *proto.FunctionArgument

func (*PrimitiveType[T]) WithNullability

func (s *PrimitiveType[T]) WithNullability(n Nullability) Type

func (*PrimitiveType[T]) WithParameters

func (s *PrimitiveType[T]) WithParameters([]interface{}) (Type, error)

type RecordType

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

RecordType is the type of a record (or row) comprising a list of fields (or columns).

func NewRecordTypeFromStruct

func NewRecordTypeFromStruct(s StructType) *RecordType

func NewRecordTypeFromTypes

func NewRecordTypeFromTypes(types []Type) *RecordType

func (RecordType) AsStructType

func (r RecordType) AsStructType() *StructType

func (RecordType) Concat

func (r RecordType) Concat(other RecordType) RecordType

func (RecordType) Equals

func (r RecordType) Equals(other *RecordType) bool

func (RecordType) FieldCount

func (r RecordType) FieldCount() int32

func (RecordType) GetFieldRef

func (r RecordType) GetFieldRef(index int32) Type

func (RecordType) String

func (r RecordType) String() string

func (RecordType) Types

func (r RecordType) Types() []Type

type SortDirection

type SortDirection proto.SortField_SortDirection

func (SortDirection) String

func (s SortDirection) String() string

type SortKind

type SortKind interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

type StringParameter

type StringParameter string

StringParameter is a type parameter which is a string value

func (StringParameter) Equals

func (p StringParameter) Equals(o TypeParam) bool

func (StringParameter) Evaluate

func (p StringParameter) Evaluate(symbolTable map[string]any) (any, error)

func (StringParameter) String

func (p StringParameter) String() string

func (StringParameter) ToProto

func (p StringParameter) ToProto() *proto.Type_Parameter

type StringType

type StringType = PrimitiveType[string]

create type aliases to the generic structs

type StringUDTParam

type StringUDTParam struct {
	StringVal string
}

func (*StringUDTParam) MatchWithNullability

func (s *StringUDTParam) MatchWithNullability(param TypeParam) bool

func (*StringUDTParam) MatchWithoutNullability

func (s *StringUDTParam) MatchWithoutNullability(param TypeParam) bool

func (*StringUDTParam) String

func (s *StringUDTParam) String() string

type StructType

type StructType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	Types            []Type
}

func (*StructType) BaseString

func (*StructType) BaseString() string

func (*StructType) Equals

func (t *StructType) Equals(rhs Type) bool

func (*StructType) GetNullability

func (s *StructType) GetNullability() Nullability

func (*StructType) GetParameters

func (s *StructType) GetParameters() []interface{}

func (*StructType) GetType

func (s *StructType) GetType() Type

func (*StructType) GetTypeVariationReference

func (s *StructType) GetTypeVariationReference() uint32

func (*StructType) ParameterString

func (t *StructType) ParameterString() string

func (*StructType) ShortString

func (*StructType) ShortString() string

func (*StructType) String

func (t *StructType) String() string

func (*StructType) ToProto

func (t *StructType) ToProto() *proto.Type

func (*StructType) ToProtoFuncArg

func (t *StructType) ToProtoFuncArg() *proto.FunctionArgument

func (*StructType) WithNullability

func (s *StructType) WithNullability(n Nullability) Type

type SymbolInfo

type SymbolInfo struct {
	Name  string
	Value any
}

type Time

type Time int64

type TimePrecision

type TimePrecision int32

TimePrecision is used to represent the precision of a timestamp

const (
	PrecisionUnknown TimePrecision = -1
	// below precision values are proto values
	PrecisionSeconds        TimePrecision = 0
	PrecisionDeciSeconds    TimePrecision = 1
	PrecisionCentiSeconds   TimePrecision = 2
	PrecisionMilliSeconds   TimePrecision = 3
	PrecisionEMinus4Seconds TimePrecision = 4 // 10^-4 of seconds
	PrecisionEMinus5Seconds TimePrecision = 5 // 10^-5 of seconds
	PrecisionMicroSeconds   TimePrecision = 6
	PrecisionEMinus7Seconds TimePrecision = 7 // 10^-7 of seconds
	PrecisionEMinus8Seconds TimePrecision = 8 // 10^-8 of seconds
	PrecisionNanoSeconds    TimePrecision = 9
)

func ProtoToTimePrecision

func ProtoToTimePrecision(val int32) (TimePrecision, error)

func (TimePrecision) ToProtoVal

func (m TimePrecision) ToProtoVal() int32

type TimeType

type TimeType = PrimitiveType[Time]

create type aliases to the generic structs

type Timestamp

type Timestamp int64

type TimestampType

type TimestampType = PrimitiveType[Timestamp]

create type aliases to the generic structs

type TimestampTz

type TimestampTz int64

type TimestampTzType

type TimestampTzType = PrimitiveType[TimestampTz]

create type aliases to the generic structs

type Type

type Type interface {
	FuncArg

	fmt.Stringer
	ShortString() string
	GetType() Type
	GetNullability() Nullability
	GetTypeVariationReference() uint32
	Equals(Type) bool
	// WithNullability returns a copy of this type but with
	// the nullability set to the passed in value
	WithNullability(Nullability) Type
	// GetParameters returns all parameters of this type and will be used in function return type derivation
	GetParameters() []interface{}
	// contains filtered or unexported methods
}

Type corresponds to the proto.Type message and represents a specific type. These are types which can be present in plan (are serializable)

func SimpleTypeNameToType

func SimpleTypeNameToType(name TypeName) (Type, error)

func TypeFromProto

func TypeFromProto(t *proto.Type) Type

TypeFromProto returns the appropriate Type object from a protobuf type message.

type TypeName

type TypeName string
const (
	TypeNameI8               TypeName = "i8"
	TypeNameI16              TypeName = "i16"
	TypeNameI32              TypeName = "i32"
	TypeNameI64              TypeName = "i64"
	TypeNameFp32             TypeName = "fp32"
	TypeNameFp64             TypeName = "fp64"
	TypeNameString           TypeName = "string"
	TypeNameBinary           TypeName = "binary"
	TypeNameBoolean          TypeName = "boolean"
	TypeNameDate             TypeName = "date"
	TypeNameTime             TypeName = "time"
	TypeNameTimestamp        TypeName = "timestamp"
	TypeNameTimestampTz      TypeName = "timestamp_tz"
	TypeNameIntervalYear     TypeName = "interval_year"
	TypeNameIntervalDay      TypeName = "interval_day"
	TypeNameIntervalCompound TypeName = "interval_compound"
	TypeNameUUID             TypeName = "uuid"
	TypeNameUDT              TypeName = "u!"

	TypeNameFixedBinary          TypeName = "fixedbinary"
	TypeNameFixedChar            TypeName = "fixedchar"
	TypeNameVarChar              TypeName = "varchar"
	TypeNameDecimal              TypeName = "decimal"
	TypeNamePrecisionTimestamp   TypeName = "precision_timestamp"
	TypeNamePrecisionTimestampTz TypeName = "precision_timestamp_tz"
)

type TypeParam

type TypeParam interface {
	ToProto() *proto.Type_Parameter
	Equals(TypeParam) bool
}

TypeParam represents a type parameter for a user defined type

func TypeParamFromProto

func TypeParamFromProto(p *proto.Type_Parameter) TypeParam

TypeParamFromProto converts a protobuf Type_Parameter message to a TypeParam object for processing.

type UDTParameter

type UDTParameter interface {
	String() string

	MatchWithoutNullability(param TypeParam) bool
	MatchWithNullability(param TypeParam) bool
	// contains filtered or unexported methods
}

type UUID

type UUID []byte

type UUIDType

type UUIDType = PrimitiveType[UUID]

create type aliases to the generic structs

type UserDefinedType

type UserDefinedType struct {
	Nullability      Nullability
	TypeVariationRef uint32
	TypeReference    uint32
	TypeParameters   []TypeParam
}

func (*UserDefinedType) Equals

func (t *UserDefinedType) Equals(rhs Type) bool

func (*UserDefinedType) GetNullability

func (s *UserDefinedType) GetNullability() Nullability

func (*UserDefinedType) GetParameters

func (s *UserDefinedType) GetParameters() []interface{}

func (*UserDefinedType) GetType

func (s *UserDefinedType) GetType() Type

func (*UserDefinedType) GetTypeVariationReference

func (s *UserDefinedType) GetTypeVariationReference() uint32

func (*UserDefinedType) ShortString

func (*UserDefinedType) ShortString() string

exists for meeting the interface, but the correct short name for a user defined type is "u!name" which requires looking up the type first via the type reference to find the name.

func (*UserDefinedType) String

func (t *UserDefinedType) String() string

func (*UserDefinedType) ToProto

func (t *UserDefinedType) ToProto() *proto.Type

func (*UserDefinedType) ToProtoFuncArg

func (t *UserDefinedType) ToProtoFuncArg() *proto.FunctionArgument

func (*UserDefinedType) WithNullability

func (s *UserDefinedType) WithNullability(n Nullability) Type

type VarCharType

type VarCharType = FixedLenType[VarChar]

create type aliases to the generic structs

type Version

type Version = proto.Version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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