value

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package value contains helper functions to convert from cty.Value to Go types.

The input value must still conform to the implied type of the given schema, or else these functions may produce garbage results or panic. This is usually okay because type consistency is enforced when deserializing the value returned from the provider over the RPC wire protocol anyway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(rawValue cty.Value) *bool

Bool evaluates the typed value of the value and coerces to a pointer of a boolean.

func Difference

func Difference(data *schema.ResourceData, key string) ([]interface{}, []interface{})

Difference accesses the value held by key and type asserts it to a set. It then compares its changes if any and returns what needs to be added and what needs to be removed.

func Float64

func Float64(rawValue cty.Value) *float64

Float64 evaluates the typed value of the value and coerces to a pointer of a float64.

func Int

func Int(rawValue cty.Value) *int

Int evaluates the typed value of the value and coerces to a pointer of an int.

func Map

func Map(rawValue cty.Value) map[string]interface{}

Map evaluates the typed value of the value and coerces to a map[string]interface{}.

func MapFromJSON

func MapFromJSON(rawValue cty.Value) (map[string]interface{}, error)

MapFromJSON evaluates the typed value of the value and coerces to a map[string]interface{}.

func MapOfStrings

func MapOfStrings(rawValue cty.Value) *map[string]string

MapOfStrings evaluates the typed value of the value and coerces to a pointer of a map of strings.

func String

func String(rawValue cty.Value) *string

String evaluates the typed value of the value and coerces to a pointer of a string.

func Strings

func Strings(rawValues cty.Value) *[]string

Strings evaluates the typed value of the value and coerces to a pointer of a slice of strings.

func Time added in v1.7.0

func Time(rawValue cty.Value) *time.Time

Time evaluates the typed value of the value and coerces to a pointer of a string, which is then converted to a `time.Time` according to ISO 3339 (ISO 8601 is largely the same in common use cases, see https://ijmacd.github.io/rfc3339-iso8601/ for differences).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳