functions

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockFunction = "function"
	BlockArg      = "arg"
)
View Source
const (
	InvokeFunctionName = "invoke"
)

Variables

This section is empty.

Functions

func ArgSchema

func ArgSchema() *hcl.BodySchema

ArgSchema is the schema for argument blocks.

func FunctionSchema

func FunctionSchema() *hcl.BodySchema

FunctionSchema is the schema for function blocks.

Types

type Arg

type Arg struct {
	Name        string    // argument name
	Description string    // optional description
	HasDefault  bool      // true if it has a default value
	Default     cty.Value // the default value
}

Arg represents an argument for a user-defined function.

type DynamicObject

type DynamicObject = map[string]cty.Value

type Processor

type Processor struct {
	Functions map[string]*UserFunction
	// contains filtered or unexported fields
}

Processor loads user functions and provides mechanisms to provide a root context. capable of invoking these functions.

func NewProcessor

func NewProcessor() *Processor

NewProcessor creates a processor.

func (*Processor) CheckUserFunctionRefs

func (e *Processor) CheckUserFunctionRefs(expr hclsyntax.Node) hcl.Diagnostics

func (*Processor) Process

func (e *Processor) Process(content *hcl.BodyContent) hcl.Diagnostics

Process processes the supplied body for function definitions.

func (*Processor) RootContext

func (e *Processor) RootContext(values DynamicObject) *hcl.EvalContext

RootContext provides a root context with the supplied variables and functions that have the standard functions as well as the special `invoke` function to invoke user-defined functions.

type UserFunction

type UserFunction struct {
	Name        string          // user function name
	Description string          // optional description
	Args        map[string]*Arg // named arguments
	// contains filtered or unexported fields
}

UserFunction represents a user-defined function.

Directories

Path Synopsis
internal
funcs/ipaddr
Package ipaddr is a fork of a subset of the Go standard "net" package which retains parsing behaviors from Go 1.16 or earlier.
Package ipaddr is a fork of a subset of the Go standard "net" package which retains parsing behaviors from Go 1.16 or earlier.

Jump to

Keyboard shortcuts

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