package compiler

import "github.com/influxdata/flux/compiler"

The compiler package provides a compiler and Go runtime for a subset of the Flux language. Only pure functions are supported by the compiler. A function is compiled and then may be called repeatedly with different arguments. The function must be pure meaning it has no side effects. Other language features are not supported.

This runtime is not portable by design. The runtime consists of Go types that have been constructed based on the Flux function being compiled. Those types are not serializable and cannot be transported to other systems or environments. This design is intended to limit the scope under which compilation must be supported.

Index

Types

type Evaluator

type Evaluator interface {
	Type() semantic.MonoType
	Eval(ctx context.Context, scope Scope) (values.Value, error)
}

type Func

type Func interface {
	Type() semantic.MonoType
	Eval(ctx context.Context, input values.Object) (values.Value, error)
}

func Compile

type Scope

type Scope interface {
	values.Scope
	Get(name string) values.Value
}

func NewScope

func NewScope() Scope

func ToScope

func ToScope(s values.Scope) Scope

Source Files

compiler.go doc.go runtime.go

Version
v0.196.1 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
1 day ago

Tools for package owners.