octosql

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MPL-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZeroValue = Value{}

Functions

func HashManyValues added in v0.11.1

func HashManyValues(values []Value) uint64

Types

type StructField

type StructField struct {
	Name string
	Type Type
}

type Type

type Type struct {
	TypeID   TypeID
	Null     struct{}
	Int      struct{}
	Float    struct{}
	Boolean  struct{}
	Str      struct{}
	Time     struct{}
	Duration struct{}
	List     struct {
		Element *Type
	}
	Struct struct {
		Fields []StructField // TODO: -> Names []string, Types []Type
	}
	Tuple struct {
		Elements []Type
	}
	Union struct {
		Alternatives []Type
	}
	Any struct{}
}

func NonNullable added in v0.5.0

func NonNullable(t Type) Type

NonNullable returns a type that is the same as the input type, but without nullability. If the input type is just Null, then this returns Null as well.

func TypeIntersection

func TypeIntersection(t1, t2 Type) *Type

func TypeSum

func TypeSum(t1, t2 Type) Type

func (Type) Equals

func (t Type) Equals(other Type) bool

func (Type) Is

func (t Type) Is(other Type) TypeRelation

func (Type) String

func (t Type) String() string

type TypeID

type TypeID int
const (
	TypeIDNull TypeID = iota
	TypeIDInt
	TypeIDFloat
	TypeIDBoolean
	TypeIDString
	TypeIDTime
	TypeIDDuration
	TypeIDList
	TypeIDStruct
	TypeIDTuple
	TypeIDUnion
	TypeIDAny // TODO: Remove this type?
)

func (TypeID) String added in v0.5.0

func (t TypeID) String() string

type TypeRelation

type TypeRelation int
const (
	TypeRelationIsnt TypeRelation = iota
	TypeRelationMaybe
	TypeRelationIs
)

type Value

type Value struct {
	TypeID   TypeID
	Int      int
	Float    float64
	Boolean  bool
	Str      string
	Time     time.Time
	Duration time.Duration
	List     []Value
	Struct   []Value
	Tuple    []Value
}

Value represents a single row value. The zero value of it is conveniently NULL.

func NewBoolean

func NewBoolean(value bool) Value

func NewDuration

func NewDuration(value time.Duration) Value

func NewFloat

func NewFloat(value float64) Value

func NewInt

func NewInt(value int) Value

func NewList

func NewList(value []Value) Value

func NewNull

func NewNull() Value

func NewString

func NewString(value string) Value

func NewStruct

func NewStruct(value []Value) Value

func NewTime

func NewTime(value time.Time) Value

func NewTuple

func NewTuple(values []Value) Value

func (Value) Compare

func (value Value) Compare(other Value) int

func (Value) Equal

func (value Value) Equal(other Value) bool

func (Value) Hash added in v0.11.0

func (value Value) Hash() uint64

func (Value) String

func (value Value) String() string

func (Value) ToRawGoValue

func (value Value) ToRawGoValue(t Type) interface{}

func (Value) Type

func (value Value) Type() Type

Jump to

Keyboard shortcuts

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