Documentation
¶
Overview ¶
Package values declares the flux data types and implements them.
Index ¶
- Variables
- func CheckKind(got, exp semantic.Nature)
- func NewObject() *object
- func NewObjectWithValues(values map[string]Value) *object
- func UnexpectedKind(got, exp semantic.Nature) error
- type Array
- type BinaryFuncSignature
- type BinaryFunction
- type Duration
- type Function
- type Object
- type Time
- type Typer
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidValue = value{/* contains filtered or unexported fields */}
InvalidValue is a non nil value who's type is semantic.Invalid
Functions ¶
func NewObjectWithValues ¶
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.Type
}
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 Value ¶
type Value interface {
Typer
Str() string
Int() int64
UInt() uint64
Float() float64
Bool() bool
Time() Time
Duration() Duration
Regexp() *regexp.Regexp
Array() Array
Object() Object
Function() Function
Equal(Value) bool
}
func New ¶
func New(v interface{}) Value
New constructs a new Value by inferring the type from the interface. If the interface does not translate to a valid Value type, then InvalidValue is returned.
func NewDuration ¶
Click to show internal directories.
Click to hide internal directories.