helper

package
v0.0.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package value contains types and methods to deal with cty value

Package converter content relative to the package

Package value contains types and methods to deal with cty value

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributeToStringWithoutContext

func AttributeToStringWithoutContext(attribute *hcl.Attribute) (string, errors.Error)

AttributeToStringWithoutContext convert a hc Attribute into a string value.

func EvalAttribute

func EvalAttribute(ctx *hcl.EvalContext, attribute *hcl.Attribute) (cty.Value, errors.Error)

EvalAttribute evaluate the hcl attribute.

func EvalAttributeAsSlice

func EvalAttributeAsSlice(ctx *hcl.EvalContext, attribute *hcl.Attribute) ([]cty.Value, errors.Error)

EvalAttributeAsSlice evaluate the hcl attribute and convert it into a slice.

func EvalExpression

func EvalExpression(ctx *hcl.EvalContext, expr hcl.Expression) (cty.Value, errors.Error)

EvalExpression evaluate the hcl expression.

func EvaluateArrayItemExpression

func EvaluateArrayItemExpression(ctx *hcl.EvalContext, name string, index int, val hcl.Expression) errors.Error

nolint EvaluateArrayItemExpression evaluate the the list of expressions.

func EvaluateExpressions

func EvaluateExpressions(ctx *hcl.EvalContext, expressions map[string]hcl.Expression) errors.Error

EvaluateExpressions evaluate the the list of expressions.

func GetExpressionValueAsBool

func GetExpressionValueAsBool(ctx *hcl.EvalContext, expr hcl.Expression, def bool) (bool, errors.Error)

GetExpressionValueAsBool return the expression as bool.

func GetExpressionValueAsDuration

func GetExpressionValueAsDuration(ctx *hcl.EvalContext, expr hcl.Expression, def *time.Duration) (*time.Duration,
	errors.Error)

GetExpressionValueAsDuration evaluate the expression and return a duration value.

func GetExpressionValueAsInt

func GetExpressionValueAsInt(ctx *hcl.EvalContext, expr hcl.Expression, def int) (int, errors.Error)

GetExpressionValueAsInt evaluate the expression and return a int value.

func GetExpressionValueAsInterface

func GetExpressionValueAsInterface(ctx *hcl.EvalContext, expr hcl.Expression, def interface{}) (interface{},
	errors.Error)

GetExpressionValueAsInterface evaluate an hcl expresion and converts into an interface.

func GetExpressionValueAsString

func GetExpressionValueAsString(ctx *hcl.EvalContext, expr hcl.Expression, def string) (string, errors.Error)

GetExpressionValueAsString return the value fo the expression as a string.

func GetValueAsBool

func GetValueAsBool(value cty.Value, def bool) bool

GetValueAsBool return the value as a bool.

func GetValueAsString

func GetValueAsString(value cty.Value, def string) string

GetValueAsString converts a given cty.Value into a string or returns a default valu.

func IsMap

func IsMap(value cty.Value) bool

IsMap return true if value is a map.

func IsSlice

func IsSlice(value cty.Value) bool

IsSlice returns true if value is a slice.

func ToInterface

func ToInterface(v cty.Value) (interface{}, errors.Error)

ToInterface converts a given cty.Value into an interface.

func ToStrictString

func ToStrictString(value cty.Value) (string, errors.Error)

ToStrictString convert the value into a string.

func ToString

func ToString(v cty.Value) (string, errors.Error)

ToString converts a given cty.Value into a string.

func ToValue

func ToValue(value interface{}) cty.Value

ToValue convert the interface into a value.

func ToValueList

func ToValueList(input []interface{}) cty.Value

ToValueList convert the array into a value.

func ToValueMap

func ToValueMap(input map[string]interface{}) cty.Value

ToValueMap convert the map into a value.

func ValuesSlice

func ValuesSlice(value cty.Value) ([]cty.Value, errors.Error)

ValuesSlice convert the value into a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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