Documentation ¶
Overview ¶
Package values declares the flux data types and implements them.
Index ¶
- Variables
- func AllLabels() labelSet
- func CheckKind(got, exp semantic.Nature)
- func Display(w io.Writer, v Value) error
- func DisplayString(v Value) string
- func FormattedScope(scope Scope) fmt.Formatter
- func IsTimeable(v Value) bool
- func NewFunction(name string, typ semantic.MonoType, ...) *function
- func UnexpectedKind(got, exp semantic.Nature) error
- func Unwrap(v Value) interface{}
- type Array
- type BinaryFuncSignature
- type BinaryFunction
- type BinaryVectorFunction
- type BooleanVectorValue
- func (v *BooleanVectorValue) Arr() arrow.Array
- func (v *BooleanVectorValue) Array() Array
- func (v *BooleanVectorValue) Bool() bool
- func (v *BooleanVectorValue) Bytes() []byte
- func (v *BooleanVectorValue) Dict() Dictionary
- func (v *BooleanVectorValue) Duration() Duration
- func (v *BooleanVectorValue) Dynamic() Dynamic
- func (v *BooleanVectorValue) ElementType() semantic.MonoType
- func (v *BooleanVectorValue) Equal(other Value) bool
- func (v *BooleanVectorValue) Float() float64
- func (v *BooleanVectorValue) Function() Function
- func (v *BooleanVectorValue) Int() int64
- func (v *BooleanVectorValue) IsNull() bool
- func (v *BooleanVectorValue) IsRepeat() bool
- func (v *BooleanVectorValue) Object() Object
- func (v *BooleanVectorValue) Regexp() *regexp.Regexp
- func (v *BooleanVectorValue) Release()
- func (v *BooleanVectorValue) Retain()
- func (v *BooleanVectorValue) Str() string
- func (v *BooleanVectorValue) Time() Time
- func (v *BooleanVectorValue) Type() semantic.MonoType
- func (v *BooleanVectorValue) UInt() uint64
- func (v *BooleanVectorValue) Vector() Vector
- type Dictionary
- type DictionaryBuilder
- type Duration
- func (d Duration) AsValues() []ast.Duration
- func (d Duration) Duration() time.Duration
- func (d Duration) Equal(other Duration) bool
- func (d Duration) IsMixed() bool
- func (d Duration) IsNegative() bool
- func (d Duration) IsPositive() bool
- func (d Duration) IsZero() bool
- func (d Duration) MarshalText() ([]byte, error)
- func (d Duration) Months() int64
- func (d Duration) MonthsOnly() bool
- func (d Duration) Mul(scale int) Duration
- func (d Duration) NanoOnly() bool
- func (d Duration) Nanoseconds() int64
- func (d Duration) Normalize(interval Duration) Duration
- func (d Duration) String() string
- func (d *Duration) UnmarshalText(data []byte) error
- type Dynamic
- type FloatVectorValue
- func (v *FloatVectorValue) Arr() arrow.Array
- func (v *FloatVectorValue) Array() Array
- func (v *FloatVectorValue) Bool() bool
- func (v *FloatVectorValue) Bytes() []byte
- func (v *FloatVectorValue) Dict() Dictionary
- func (v *FloatVectorValue) Duration() Duration
- func (v *FloatVectorValue) Dynamic() Dynamic
- func (v *FloatVectorValue) ElementType() semantic.MonoType
- func (v *FloatVectorValue) Equal(other Value) bool
- func (v *FloatVectorValue) Float() float64
- func (v *FloatVectorValue) Function() Function
- func (v *FloatVectorValue) Int() int64
- func (v *FloatVectorValue) IsNull() bool
- func (v *FloatVectorValue) IsRepeat() bool
- func (v *FloatVectorValue) Object() Object
- func (v *FloatVectorValue) Regexp() *regexp.Regexp
- func (v *FloatVectorValue) Release()
- func (v *FloatVectorValue) Retain()
- func (v *FloatVectorValue) Str() string
- func (v *FloatVectorValue) Time() Time
- func (v *FloatVectorValue) Type() semantic.MonoType
- func (v *FloatVectorValue) UInt() uint64
- func (v *FloatVectorValue) Vector() Vector
- type Function
- type IntVectorValue
- func (v *IntVectorValue) Arr() arrow.Array
- func (v *IntVectorValue) Array() Array
- func (v *IntVectorValue) Bool() bool
- func (v *IntVectorValue) Bytes() []byte
- func (v *IntVectorValue) Dict() Dictionary
- func (v *IntVectorValue) Duration() Duration
- func (v *IntVectorValue) Dynamic() Dynamic
- func (v *IntVectorValue) ElementType() semantic.MonoType
- func (v *IntVectorValue) Equal(other Value) bool
- func (v *IntVectorValue) Float() float64
- func (v *IntVectorValue) Function() Function
- func (v *IntVectorValue) Int() int64
- func (v *IntVectorValue) IsNull() bool
- func (v *IntVectorValue) IsRepeat() bool
- func (v *IntVectorValue) Object() Object
- func (v *IntVectorValue) Regexp() *regexp.Regexp
- func (v *IntVectorValue) Release()
- func (v *IntVectorValue) Retain()
- func (v *IntVectorValue) Str() string
- func (v *IntVectorValue) Time() Time
- func (v *IntVectorValue) Type() semantic.MonoType
- func (v *IntVectorValue) UInt() uint64
- func (v *IntVectorValue) Vector() Vector
- type Object
- type ObjectSetter
- type Option
- type Package
- type Scope
- type StringVectorValue
- func (v *StringVectorValue) Arr() arrow.Array
- func (v *StringVectorValue) Array() Array
- func (v *StringVectorValue) Bool() bool
- func (v *StringVectorValue) Bytes() []byte
- func (v *StringVectorValue) Dict() Dictionary
- func (v *StringVectorValue) Duration() Duration
- func (v *StringVectorValue) Dynamic() Dynamic
- func (v *StringVectorValue) ElementType() semantic.MonoType
- func (v *StringVectorValue) Equal(other Value) bool
- func (v *StringVectorValue) Float() float64
- func (v *StringVectorValue) Function() Function
- func (v *StringVectorValue) Int() int64
- func (v *StringVectorValue) IsNull() bool
- func (v *StringVectorValue) IsRepeat() bool
- func (v *StringVectorValue) Object() Object
- func (v *StringVectorValue) Regexp() *regexp.Regexp
- func (v *StringVectorValue) Release()
- func (v *StringVectorValue) Retain()
- func (v *StringVectorValue) Str() string
- func (v *StringVectorValue) Time() Time
- func (v *StringVectorValue) Type() semantic.MonoType
- func (v *StringVectorValue) UInt() uint64
- func (v *StringVectorValue) Vector() Vector
- type Time
- type TimeVectorValue
- func (v *TimeVectorValue) Arr() arrow.Array
- func (v *TimeVectorValue) Array() Array
- func (v *TimeVectorValue) Bool() bool
- func (v *TimeVectorValue) Bytes() []byte
- func (v *TimeVectorValue) Dict() Dictionary
- func (v *TimeVectorValue) Duration() Duration
- func (v *TimeVectorValue) Dynamic() Dynamic
- func (v *TimeVectorValue) ElementType() semantic.MonoType
- func (v *TimeVectorValue) Equal(other Value) bool
- func (v *TimeVectorValue) Float() float64
- func (v *TimeVectorValue) Function() Function
- func (v *TimeVectorValue) Int() int64
- func (v *TimeVectorValue) IsNull() bool
- func (v *TimeVectorValue) IsRepeat() bool
- func (v *TimeVectorValue) Object() Object
- func (v *TimeVectorValue) Regexp() *regexp.Regexp
- func (v *TimeVectorValue) Release()
- func (v *TimeVectorValue) Retain()
- func (v *TimeVectorValue) Str() string
- func (v *TimeVectorValue) Time() Time
- func (v *TimeVectorValue) Type() semantic.MonoType
- func (v *TimeVectorValue) UInt() uint64
- func (v *TimeVectorValue) Vector() Vector
- type Typer
- type UintVectorValue
- func (v *UintVectorValue) Arr() arrow.Array
- func (v *UintVectorValue) Array() Array
- func (v *UintVectorValue) Bool() bool
- func (v *UintVectorValue) Bytes() []byte
- func (v *UintVectorValue) Dict() Dictionary
- func (v *UintVectorValue) Duration() Duration
- func (v *UintVectorValue) Dynamic() Dynamic
- func (v *UintVectorValue) ElementType() semantic.MonoType
- func (v *UintVectorValue) Equal(other Value) bool
- func (v *UintVectorValue) Float() float64
- func (v *UintVectorValue) Function() Function
- func (v *UintVectorValue) Int() int64
- func (v *UintVectorValue) IsNull() bool
- func (v *UintVectorValue) IsRepeat() bool
- func (v *UintVectorValue) Object() Object
- func (v *UintVectorValue) Regexp() *regexp.Regexp
- func (v *UintVectorValue) Release()
- func (v *UintVectorValue) Retain()
- func (v *UintVectorValue) Str() string
- func (v *UintVectorValue) Time() Time
- func (v *UintVectorValue) Type() semantic.MonoType
- func (v *UintVectorValue) UInt() uint64
- func (v *UintVectorValue) Vector() Vector
- type Value
- func New(v interface{}) Value
- func NewBool(v bool) Value
- func NewBytes(v []byte) Value
- func NewDuration(v Duration) Value
- func NewFloat(v float64) Value
- func NewInt(v int64) Value
- func NewNull(t semantic.MonoType) Value
- func NewRegexp(v *regexp.Regexp) Value
- func NewString(v string) Value
- func NewTime(v Time) Value
- func NewUInt(v uint64) Value
- func SetOption(p Package, name string, v Value) (Value, bool)
- func Stringify(v Value) (Value, error)
- func VectorConditional(t Vector, c, a Value, mem memory.Allocator) (Value, error)
- func VectorExists(v Vector, mem memory.Allocator) (Value, error)
- func VectorNot(v Vector, mem memory.Allocator) (Value, error)
- func VectorUnarySub(v Vector, mem memory.Allocator) (Value, error)
- type Vector
- func NewBooleanVectorValue(arr *arrow.Boolean) Vector
- func NewFloatVectorValue(arr *arrow.Float) Vector
- func NewIntVectorValue(arr *arrow.Int) Vector
- func NewStringVectorValue(arr *arrow.String) Vector
- func NewTimeVectorValue(arr *arrow.Int) Vector
- func NewUintVectorValue(arr *arrow.Uint) Vector
- func NewVectorFromElements(mem memory.Allocator, es ...interface{}) Vector
- func NewVectorRepeatValue(v Value) Vector
- func NewVectorValue(arr arrow.Array, typ semantic.MonoType) Vector
- type VectorRepeatValue
- func (v *VectorRepeatValue) Arr() arrow.Array
- func (v *VectorRepeatValue) Array() Array
- func (v *VectorRepeatValue) Bool() bool
- func (v *VectorRepeatValue) Bytes() []byte
- func (v *VectorRepeatValue) Dict() Dictionary
- func (v *VectorRepeatValue) Duration() Duration
- func (v *VectorRepeatValue) Dynamic() Dynamic
- func (v *VectorRepeatValue) ElementType() semantic.MonoType
- func (v *VectorRepeatValue) Equal(other Value) bool
- func (v *VectorRepeatValue) Float() float64
- func (v *VectorRepeatValue) Function() Function
- func (v *VectorRepeatValue) Int() int64
- func (v *VectorRepeatValue) IsNull() bool
- func (v *VectorRepeatValue) IsRepeat() bool
- func (v *VectorRepeatValue) Object() Object
- func (v *VectorRepeatValue) Regexp() *regexp.Regexp
- func (v *VectorRepeatValue) Release()
- func (v *VectorRepeatValue) Retain()
- func (v *VectorRepeatValue) Str() string
- func (v *VectorRepeatValue) Time() Time
- func (v *VectorRepeatValue) Type() semantic.MonoType
- func (v *VectorRepeatValue) UInt() uint64
- func (v *VectorRepeatValue) Value() Value
- func (v *VectorRepeatValue) Vector() Vector
Constants ¶
This section is empty.
Variables ¶
var ( // InvalidValue is a non nil value who's type is semantic.Invalid InvalidValue = value{} // Null is an untyped nil value. Null = null{} // Void is an empty record used to represent a void value. Void = NewObject(semantic.NewObjectType(nil)) )
Functions ¶
func AllLabels ¶
func AllLabels() labelSet
AllLabels returns a label set that represents the infinite set of all possible string labels.
func DisplayString ¶
DisplayString formats the value into a string
func FormattedScope ¶
FormattedScope produces a fmt.Formatter for pretty printing a scope.
func NewFunction ¶
func NewFunction(name string, typ semantic.MonoType, call func(ctx context.Context, args Object) (Value, error), sideEffect bool) *function
NewFunction returns a new function value. This function will panic if it is passed anything other than a function type.
func UnexpectedKind ¶
Types ¶
type Array ¶
type Array interface { Value Get(i int) Value Set(i int, v Value) Append(v Value) Len() int Range(func(i int, v Value)) Sort(func(i, j Value) bool) }
Array represents an sequence of elements All elements must be the same type
type BinaryFuncSignature ¶
type BinaryFuncSignature struct { Operator ast.OperatorKind Left, Right semantic.Nature }
type BinaryFunction ¶
func LookupBinaryFunction ¶
func LookupBinaryFunction(sig BinaryFuncSignature) (BinaryFunction, error)
LookupBinaryFunction returns an appropriate binary function that evaluates two values and returns another value. If the two types are not compatible with the given operation, this returns an error.
type BinaryVectorFunction ¶
func LookupBinaryVectorFunction ¶
func LookupBinaryVectorFunction(sig BinaryFuncSignature) (BinaryVectorFunction, error)
type BooleanVectorValue ¶
type BooleanVectorValue struct {
// contains filtered or unexported fields
}
func (*BooleanVectorValue) Arr ¶
func (v *BooleanVectorValue) Arr() arrow.Array
func (*BooleanVectorValue) Array ¶
func (v *BooleanVectorValue) Array() Array
func (*BooleanVectorValue) Bool ¶
func (v *BooleanVectorValue) Bool() bool
func (*BooleanVectorValue) Bytes ¶
func (v *BooleanVectorValue) Bytes() []byte
func (*BooleanVectorValue) Dict ¶
func (v *BooleanVectorValue) Dict() Dictionary
func (*BooleanVectorValue) Duration ¶
func (v *BooleanVectorValue) Duration() Duration
func (*BooleanVectorValue) Dynamic ¶
func (v *BooleanVectorValue) Dynamic() Dynamic
func (*BooleanVectorValue) ElementType ¶
func (v *BooleanVectorValue) ElementType() semantic.MonoType
func (*BooleanVectorValue) Equal ¶
func (v *BooleanVectorValue) Equal(other Value) bool
func (*BooleanVectorValue) Float ¶
func (v *BooleanVectorValue) Float() float64
func (*BooleanVectorValue) Function ¶
func (v *BooleanVectorValue) Function() Function
func (*BooleanVectorValue) Int ¶
func (v *BooleanVectorValue) Int() int64
func (*BooleanVectorValue) IsNull ¶
func (v *BooleanVectorValue) IsNull() bool
func (*BooleanVectorValue) IsRepeat ¶
func (v *BooleanVectorValue) IsRepeat() bool
func (*BooleanVectorValue) Object ¶
func (v *BooleanVectorValue) Object() Object
func (*BooleanVectorValue) Regexp ¶
func (v *BooleanVectorValue) Regexp() *regexp.Regexp
func (*BooleanVectorValue) Release ¶
func (v *BooleanVectorValue) Release()
func (*BooleanVectorValue) Retain ¶
func (v *BooleanVectorValue) Retain()
func (*BooleanVectorValue) Str ¶
func (v *BooleanVectorValue) Str() string
func (*BooleanVectorValue) Time ¶
func (v *BooleanVectorValue) Time() Time
func (*BooleanVectorValue) Type ¶
func (v *BooleanVectorValue) Type() semantic.MonoType
func (*BooleanVectorValue) UInt ¶
func (v *BooleanVectorValue) UInt() uint64
func (*BooleanVectorValue) Vector ¶
func (v *BooleanVectorValue) Vector() Vector
type Dictionary ¶
type Dictionary interface { Value // Get will retrieve a Value out of the Dictionary. // If the key is not present, the def Value will // be returned instead. Get(key, def Value) Value // Insert will insert a Value into the Dictionary // using the key and value. It will return a new // Dictionary with the key/value inserted. If the // key was already in the Dictionary, it will // be replaced. // // Attempting to insert a null value for the key // will return an error. Insert(key, value Value) (Dictionary, error) // Remove will remove the key/value pair that // matches with the key. It will return a new // Dictionary with the key/value removed. Remove(key Value) Dictionary // Range will iterate over each element in // the Dictionary. Range(func(key, value Value)) // Len returns the number of elements inside of // Dictionary. Len() int }
Dictionary defines the interface for a dictionary.
A Dictionary is immutable. Changes to a Dictionary will return a new Dictionary.
func NewDict ¶
func NewDict(dictType semantic.MonoType) Dictionary
NewDict will construct a new Dictionary with the given key type.
func NewEmptyDict ¶
func NewEmptyDict(ty semantic.MonoType) Dictionary
NewEmptyDict will construct an empty dictionary
type DictionaryBuilder ¶
type DictionaryBuilder struct {
// contains filtered or unexported fields
}
DictionaryBuilder can be used to construct a Dictionary with in-place memory instead of successive Insert calls that create new Dictionary values.
func NewDictBuilder ¶
func NewDictBuilder(dictType semantic.MonoType) DictionaryBuilder
NewDictBuilder will create a new DictionaryBuilder for the given key type.
func (*DictionaryBuilder) Dict ¶
func (d *DictionaryBuilder) Dict() Dictionary
Dict will construct a new Dictionary using the inserted values.
func (*DictionaryBuilder) Get ¶
func (d *DictionaryBuilder) Get(key Value) (Value, bool)
Get will retrieve a Value if it is present.
func (*DictionaryBuilder) Insert ¶
func (d *DictionaryBuilder) Insert(key, value Value) error
Insert will insert a new key/value pair into the Dictionary.
func (*DictionaryBuilder) Remove ¶
func (d *DictionaryBuilder) Remove(key Value)
Remove will remove a key/value pair from the Dictionary.
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration is a vector representing the duration unit components.
func ConvertDurationMonths ¶
ConvertDurationMonths takes a time.Duration and converts it into a Duration with months.
func ConvertDurationNsecs ¶
ConvertDurationNsecs takes a time.Duration and converts it into a Duration with nanoseconds.
func FromDurationValues ¶
FromDurationValues creates a duration value from the duration values.
func MakeDuration ¶
MakeDuration takes nanoseconds and months as int64 and negative as a bool to construct a Duration with mixed units
func ParseDuration ¶
func (Duration) AsValues ¶
AsValues will reconstruct the duration as a set of values. All of the components will be positive numbers.
func (Duration) Duration ¶
Duration will return the nanosecond equivalent of this duration. It will assume that all months are the same length.
It is recommended not to use this method unless it is absolutely needed. This method will lose any precision that is present in the Duration and it should only be used for interfacing with outside code that is not month-aware.
func (Duration) IsMixed ¶
IsMixed returns true if this duration has a combination of month and nanosecond components.
func (Duration) IsNegative ¶
IsNegative returns true if this is a negative number. It returns false if the number is zero.
func (Duration) IsPositive ¶
IsPositive returns true if this is a positive number. It returns false if the number is zero.
func (Duration) MarshalText ¶
func (Duration) MonthsOnly ¶
MonthsOnly returns true if this duration does not have a nanosecond component.
func (Duration) Mul ¶
Mul will multiply the Duration by a scalar. This multiplies each component of the vector.
func (Duration) Nanoseconds ¶
func (Duration) Normalize ¶
Normalize will normalize the duration within the interval. It will ensure that the output duration is the smallest positive duration that is the equivalent of the current duration.
func (*Duration) UnmarshalText ¶
type Dynamic ¶
func NewDynamic ¶
NewDynamic will recursively wrap a Value in Dynamic. Note that any Value can be wrapped, but only a subset have user-facing means of extraction. If you want to produce a user-facing error for certain types, do so in the caller.
type FloatVectorValue ¶
type FloatVectorValue struct {
// contains filtered or unexported fields
}
func (*FloatVectorValue) Arr ¶
func (v *FloatVectorValue) Arr() arrow.Array
func (*FloatVectorValue) Array ¶
func (v *FloatVectorValue) Array() Array
func (*FloatVectorValue) Bool ¶
func (v *FloatVectorValue) Bool() bool
func (*FloatVectorValue) Bytes ¶
func (v *FloatVectorValue) Bytes() []byte
func (*FloatVectorValue) Dict ¶
func (v *FloatVectorValue) Dict() Dictionary
func (*FloatVectorValue) Duration ¶
func (v *FloatVectorValue) Duration() Duration
func (*FloatVectorValue) Dynamic ¶
func (v *FloatVectorValue) Dynamic() Dynamic
func (*FloatVectorValue) ElementType ¶
func (v *FloatVectorValue) ElementType() semantic.MonoType
func (*FloatVectorValue) Equal ¶
func (v *FloatVectorValue) Equal(other Value) bool
func (*FloatVectorValue) Float ¶
func (v *FloatVectorValue) Float() float64
func (*FloatVectorValue) Function ¶
func (v *FloatVectorValue) Function() Function
func (*FloatVectorValue) Int ¶
func (v *FloatVectorValue) Int() int64
func (*FloatVectorValue) IsNull ¶
func (v *FloatVectorValue) IsNull() bool
func (*FloatVectorValue) IsRepeat ¶
func (v *FloatVectorValue) IsRepeat() bool
func (*FloatVectorValue) Object ¶
func (v *FloatVectorValue) Object() Object
func (*FloatVectorValue) Regexp ¶
func (v *FloatVectorValue) Regexp() *regexp.Regexp
func (*FloatVectorValue) Release ¶
func (v *FloatVectorValue) Release()
func (*FloatVectorValue) Retain ¶
func (v *FloatVectorValue) Retain()
func (*FloatVectorValue) Str ¶
func (v *FloatVectorValue) Str() string
func (*FloatVectorValue) Time ¶
func (v *FloatVectorValue) Time() Time
func (*FloatVectorValue) Type ¶
func (v *FloatVectorValue) Type() semantic.MonoType
func (*FloatVectorValue) UInt ¶
func (v *FloatVectorValue) UInt() uint64
func (*FloatVectorValue) Vector ¶
func (v *FloatVectorValue) Vector() Vector
type Function ¶
type Function interface { Value HasSideEffect() bool Call(ctx context.Context, args Object) (Value, error) }
Function represents a callable type
type IntVectorValue ¶
type IntVectorValue struct {
// contains filtered or unexported fields
}
func (*IntVectorValue) Arr ¶
func (v *IntVectorValue) Arr() arrow.Array
func (*IntVectorValue) Array ¶
func (v *IntVectorValue) Array() Array
func (*IntVectorValue) Bool ¶
func (v *IntVectorValue) Bool() bool
func (*IntVectorValue) Bytes ¶
func (v *IntVectorValue) Bytes() []byte
func (*IntVectorValue) Dict ¶
func (v *IntVectorValue) Dict() Dictionary
func (*IntVectorValue) Duration ¶
func (v *IntVectorValue) Duration() Duration
func (*IntVectorValue) Dynamic ¶
func (v *IntVectorValue) Dynamic() Dynamic
func (*IntVectorValue) ElementType ¶
func (v *IntVectorValue) ElementType() semantic.MonoType
func (*IntVectorValue) Equal ¶
func (v *IntVectorValue) Equal(other Value) bool
func (*IntVectorValue) Float ¶
func (v *IntVectorValue) Float() float64
func (*IntVectorValue) Function ¶
func (v *IntVectorValue) Function() Function
func (*IntVectorValue) Int ¶
func (v *IntVectorValue) Int() int64
func (*IntVectorValue) IsNull ¶
func (v *IntVectorValue) IsNull() bool
func (*IntVectorValue) IsRepeat ¶
func (v *IntVectorValue) IsRepeat() bool
func (*IntVectorValue) Object ¶
func (v *IntVectorValue) Object() Object
func (*IntVectorValue) Regexp ¶
func (v *IntVectorValue) Regexp() *regexp.Regexp
func (*IntVectorValue) Release ¶
func (v *IntVectorValue) Release()
func (*IntVectorValue) Retain ¶
func (v *IntVectorValue) Retain()
func (*IntVectorValue) Str ¶
func (v *IntVectorValue) Str() string
func (*IntVectorValue) Time ¶
func (v *IntVectorValue) Time() Time
func (*IntVectorValue) Type ¶
func (v *IntVectorValue) Type() semantic.MonoType
func (*IntVectorValue) UInt ¶
func (v *IntVectorValue) UInt() uint64
func (*IntVectorValue) Vector ¶
func (v *IntVectorValue) Vector() Vector
type Object ¶
type Object interface { Value Get(name string) (Value, bool) // Set will set the object value for the given key. // The key must be part of the object property's type and the // value that is set must match that type. It is undefined // behavior to set a non-existant value or to set a value // with the wrong type. Set(name string, v Value) Len() int Range(func(name string, v Value)) }
func BuildObject ¶
func BuildObject(fn func(set ObjectSetter) error) (Object, error)
BuildObject will build an object by setting key/value pairs. The records in the object get constructed in the order they are set and resetting a key will overwrite a previous value, but will retain the existing position.
func BuildObjectWithSize ¶
func BuildObjectWithSize(sz int, fn func(set ObjectSetter) error) (Object, error)
BuildObjectWithSize will build an object with an initial size.
func NewObject ¶
NewObject will create a new object with the given type. The type must be of kind Row. The new object will be uninitialized and must be constructed with Set on each of the property keys before it is used.
func NewObjectWithValues ¶
type ObjectSetter ¶
ObjectSetter will set the value for the key. If the key already exists, it will be overwritten with the new value.
type Option ¶
type Option struct {
Value
}
Option is a value that has been declared as an option within the package. An option can be modified by another package from outside of the scope that the option was originally defined in, but it will affect the original scope it was defined in.
type Scope ¶
type Scope interface { // Lookup a name in the scope. Lookup(name string) (Value, bool) // LocalLookup a name in current scope only. LocalLookup(name string) (Value, bool) // Set binds a variable in the current scope. Set(name string, v Value) // Nest creates a new scope by nesting the current scope. // If the passed in object is not nil, its values will be added to the new nested scope. Nest(Object) Scope // Pop returns the parent of the current scope. Pop() Scope // Size is the number of visible names in scope. Size() int // Range iterates over all variable bindings in scope applying f. Range(f func(k string, v Value)) // LocalRange iterates over all variable bindings only in the current scope. LocalRange(f func(k string, v Value)) // SetReturn binds the return value of the scope. SetReturn(Value) // Return reports the bound return value of the scope. Return() Value // Copy creates a deep copy of the scope, values are not copied. // Copy preserves the nesting structure. Copy() Scope }
func NewNestedScope ¶
NewNestedScope creates a new scope with bindings from obj and a parent.
type StringVectorValue ¶
type StringVectorValue struct {
// contains filtered or unexported fields
}
func (*StringVectorValue) Arr ¶
func (v *StringVectorValue) Arr() arrow.Array
func (*StringVectorValue) Array ¶
func (v *StringVectorValue) Array() Array
func (*StringVectorValue) Bool ¶
func (v *StringVectorValue) Bool() bool
func (*StringVectorValue) Bytes ¶
func (v *StringVectorValue) Bytes() []byte
func (*StringVectorValue) Dict ¶
func (v *StringVectorValue) Dict() Dictionary
func (*StringVectorValue) Duration ¶
func (v *StringVectorValue) Duration() Duration
func (*StringVectorValue) Dynamic ¶
func (v *StringVectorValue) Dynamic() Dynamic
func (*StringVectorValue) ElementType ¶
func (v *StringVectorValue) ElementType() semantic.MonoType
func (*StringVectorValue) Equal ¶
func (v *StringVectorValue) Equal(other Value) bool
func (*StringVectorValue) Float ¶
func (v *StringVectorValue) Float() float64
func (*StringVectorValue) Function ¶
func (v *StringVectorValue) Function() Function
func (*StringVectorValue) Int ¶
func (v *StringVectorValue) Int() int64
func (*StringVectorValue) IsNull ¶
func (v *StringVectorValue) IsNull() bool
func (*StringVectorValue) IsRepeat ¶
func (v *StringVectorValue) IsRepeat() bool
func (*StringVectorValue) Object ¶
func (v *StringVectorValue) Object() Object
func (*StringVectorValue) Regexp ¶
func (v *StringVectorValue) Regexp() *regexp.Regexp
func (*StringVectorValue) Release ¶
func (v *StringVectorValue) Release()
func (*StringVectorValue) Retain ¶
func (v *StringVectorValue) Retain()
func (*StringVectorValue) Str ¶
func (v *StringVectorValue) Str() string
func (*StringVectorValue) Time ¶
func (v *StringVectorValue) Time() Time
func (*StringVectorValue) Type ¶
func (v *StringVectorValue) Type() semantic.MonoType
func (*StringVectorValue) UInt ¶
func (v *StringVectorValue) UInt() uint64
func (*StringVectorValue) Vector ¶
func (v *StringVectorValue) Vector() Vector
type Time ¶
type Time int64
func ConvertTime ¶
type TimeVectorValue ¶
type TimeVectorValue struct {
// contains filtered or unexported fields
}
func (*TimeVectorValue) Arr ¶
func (v *TimeVectorValue) Arr() arrow.Array
func (*TimeVectorValue) Array ¶
func (v *TimeVectorValue) Array() Array
func (*TimeVectorValue) Bool ¶
func (v *TimeVectorValue) Bool() bool
func (*TimeVectorValue) Bytes ¶
func (v *TimeVectorValue) Bytes() []byte
func (*TimeVectorValue) Dict ¶
func (v *TimeVectorValue) Dict() Dictionary
func (*TimeVectorValue) Duration ¶
func (v *TimeVectorValue) Duration() Duration
func (*TimeVectorValue) Dynamic ¶
func (v *TimeVectorValue) Dynamic() Dynamic
func (*TimeVectorValue) ElementType ¶
func (v *TimeVectorValue) ElementType() semantic.MonoType
func (*TimeVectorValue) Equal ¶
func (v *TimeVectorValue) Equal(other Value) bool
func (*TimeVectorValue) Float ¶
func (v *TimeVectorValue) Float() float64
func (*TimeVectorValue) Function ¶
func (v *TimeVectorValue) Function() Function
func (*TimeVectorValue) Int ¶
func (v *TimeVectorValue) Int() int64
func (*TimeVectorValue) IsNull ¶
func (v *TimeVectorValue) IsNull() bool
func (*TimeVectorValue) IsRepeat ¶
func (v *TimeVectorValue) IsRepeat() bool
func (*TimeVectorValue) Object ¶
func (v *TimeVectorValue) Object() Object
func (*TimeVectorValue) Regexp ¶
func (v *TimeVectorValue) Regexp() *regexp.Regexp
func (*TimeVectorValue) Release ¶
func (v *TimeVectorValue) Release()
func (*TimeVectorValue) Retain ¶
func (v *TimeVectorValue) Retain()
func (*TimeVectorValue) Str ¶
func (v *TimeVectorValue) Str() string
func (*TimeVectorValue) Time ¶
func (v *TimeVectorValue) Time() Time
func (*TimeVectorValue) Type ¶
func (v *TimeVectorValue) Type() semantic.MonoType
func (*TimeVectorValue) UInt ¶
func (v *TimeVectorValue) UInt() uint64
func (*TimeVectorValue) Vector ¶
func (v *TimeVectorValue) Vector() Vector
type UintVectorValue ¶
type UintVectorValue struct {
// contains filtered or unexported fields
}
func (*UintVectorValue) Arr ¶
func (v *UintVectorValue) Arr() arrow.Array
func (*UintVectorValue) Array ¶
func (v *UintVectorValue) Array() Array
func (*UintVectorValue) Bool ¶
func (v *UintVectorValue) Bool() bool
func (*UintVectorValue) Bytes ¶
func (v *UintVectorValue) Bytes() []byte
func (*UintVectorValue) Dict ¶
func (v *UintVectorValue) Dict() Dictionary
func (*UintVectorValue) Duration ¶
func (v *UintVectorValue) Duration() Duration
func (*UintVectorValue) Dynamic ¶
func (v *UintVectorValue) Dynamic() Dynamic
func (*UintVectorValue) ElementType ¶
func (v *UintVectorValue) ElementType() semantic.MonoType
func (*UintVectorValue) Equal ¶
func (v *UintVectorValue) Equal(other Value) bool
func (*UintVectorValue) Float ¶
func (v *UintVectorValue) Float() float64
func (*UintVectorValue) Function ¶
func (v *UintVectorValue) Function() Function
func (*UintVectorValue) Int ¶
func (v *UintVectorValue) Int() int64
func (*UintVectorValue) IsNull ¶
func (v *UintVectorValue) IsNull() bool
func (*UintVectorValue) IsRepeat ¶
func (v *UintVectorValue) IsRepeat() bool
func (*UintVectorValue) Object ¶
func (v *UintVectorValue) Object() Object
func (*UintVectorValue) Regexp ¶
func (v *UintVectorValue) Regexp() *regexp.Regexp
func (*UintVectorValue) Release ¶
func (v *UintVectorValue) Release()
func (*UintVectorValue) Retain ¶
func (v *UintVectorValue) Retain()
func (*UintVectorValue) Str ¶
func (v *UintVectorValue) Str() string
func (*UintVectorValue) Time ¶
func (v *UintVectorValue) Time() Time
func (*UintVectorValue) Type ¶
func (v *UintVectorValue) Type() semantic.MonoType
func (*UintVectorValue) UInt ¶
func (v *UintVectorValue) UInt() uint64
func (*UintVectorValue) Vector ¶
func (v *UintVectorValue) Vector() Vector
type Value ¶
type Value interface { Typer IsNull() bool Str() string Bytes() []byte Int() int64 UInt() uint64 Float() float64 Bool() bool Time() Time Duration() Duration Regexp() *regexp.Regexp Array() Array Object() Object Function() Function Dict() Dictionary Dynamic() Dynamic Vector() Vector Equal(Value) bool Retain() Release() }
func New ¶
func New(v interface{}) Value
New constructs a new Value by inferring the type from the interface. Note this method will panic if passed a nil value. If the interface does not translate to a valid Value type, then InvalidValue is returned.
func NewDuration ¶
func SetOption ¶
SetOption will set an option on the package and return the value representing the option.
func VectorConditional ¶
VectorConditional delegates the branch selection and necessary array building to specialized (by input type) functions in the `array` package, then wraps the output as a Value.
For cases where `t` is constant (either by happening to be all the same value, or by being a `VectorRepeatValue`) the caller should skip this function and return either the consequent or alternate directly. With constant `t` is expected to be handled higher up, this function will error if it receives a `VectorRepeatValue` for this parameter.
Cases where either or both of the consequent `c` and alternate `a` are `VectorRepeatValue`s are supported.
Similar to the vec repeat situation, cases where either `c` or `a` are invalid (aka null), we treat this as if we have a null constant for the given branch. Items selected from the branch will produce nulls in the output. For cases where both `c` and `a` are null, we short circuit immediately returning a new untyped null Value.
type Vector ¶
func NewBooleanVectorValue ¶
func NewFloatVectorValue ¶
func NewIntVectorValue ¶
func NewStringVectorValue ¶
func NewTimeVectorValue ¶
func NewUintVectorValue ¶
func NewVectorFromElements ¶
A convenience method for unit testing
func NewVectorRepeatValue ¶
type VectorRepeatValue ¶
type VectorRepeatValue struct {
// contains filtered or unexported fields
}
func (*VectorRepeatValue) Arr ¶
func (v *VectorRepeatValue) Arr() arrow.Array
func (*VectorRepeatValue) Array ¶
func (v *VectorRepeatValue) Array() Array
func (*VectorRepeatValue) Bool ¶
func (v *VectorRepeatValue) Bool() bool
func (*VectorRepeatValue) Bytes ¶
func (v *VectorRepeatValue) Bytes() []byte
func (*VectorRepeatValue) Dict ¶
func (v *VectorRepeatValue) Dict() Dictionary
func (*VectorRepeatValue) Duration ¶
func (v *VectorRepeatValue) Duration() Duration
func (*VectorRepeatValue) Dynamic ¶
func (v *VectorRepeatValue) Dynamic() Dynamic
func (*VectorRepeatValue) ElementType ¶
func (v *VectorRepeatValue) ElementType() semantic.MonoType
func (*VectorRepeatValue) Equal ¶
func (v *VectorRepeatValue) Equal(other Value) bool
func (*VectorRepeatValue) Float ¶
func (v *VectorRepeatValue) Float() float64
func (*VectorRepeatValue) Function ¶
func (v *VectorRepeatValue) Function() Function
func (*VectorRepeatValue) Int ¶
func (v *VectorRepeatValue) Int() int64
func (*VectorRepeatValue) IsNull ¶
func (v *VectorRepeatValue) IsNull() bool
func (*VectorRepeatValue) IsRepeat ¶
func (v *VectorRepeatValue) IsRepeat() bool
func (*VectorRepeatValue) Object ¶
func (v *VectorRepeatValue) Object() Object
func (*VectorRepeatValue) Regexp ¶
func (v *VectorRepeatValue) Regexp() *regexp.Regexp
func (*VectorRepeatValue) Release ¶
func (v *VectorRepeatValue) Release()
func (*VectorRepeatValue) Retain ¶
func (v *VectorRepeatValue) Retain()
func (*VectorRepeatValue) Str ¶
func (v *VectorRepeatValue) Str() string
func (*VectorRepeatValue) Time ¶
func (v *VectorRepeatValue) Time() Time
func (*VectorRepeatValue) Type ¶
func (v *VectorRepeatValue) Type() semantic.MonoType
func (*VectorRepeatValue) UInt ¶
func (v *VectorRepeatValue) UInt() uint64
func (*VectorRepeatValue) Value ¶
func (v *VectorRepeatValue) Value() Value
func (*VectorRepeatValue) Vector ¶
func (v *VectorRepeatValue) Vector() Vector