reflect

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildValue

func BuildValue(ctx context.Context, typ attr.Type, val tftypes.Value, target reflect.Value, opts Options, path *tftypes.AttributePath) (reflect.Value, diag.Diagnostics)

BuildValue constructs a reflect.Value of the same type as `target`, populated with the data in `val`. It will defensively instantiate new values to set, making it safe for use with pointer types which may be nil. It tries to give consumers the ability to override its default behaviors wherever possible.

func FromAttributeValue

func FromAttributeValue(ctx context.Context, typ attr.Type, val attr.Value, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics)

FromAttributeValue creates an attr.Value from an attr.Value. It just returns the attr.Value it is passed, but reserves the right in the future to do some validation on that attr.Value to make sure it matches the type produced by `typ`.

It is meant to be called through FromValue, not directly.

func FromBigFloat

func FromBigFloat(ctx context.Context, typ attr.Type, val *big.Float, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics)

FromBigFloat creates an attr.Value using `typ` from a *big.Float.

It is meant to be called through FromValue, not directly.

func FromBigInt

func FromBigInt(ctx context.Context, typ attr.Type, val *big.Int, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics)

FromBigInt creates an attr.Value using `typ` from a *big.Int.

It is meant to be called through FromValue, not directly.

func FromBool

func FromBool(ctx context.Context, typ attr.Type, val bool, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics)

FromBool returns an attr.Value as produced by `typ` from a bool.

It is meant to be called through FromValue, not directly.

func FromFloat

func FromFloat(ctx context.Context, typ attr.Type, val float64, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics)

FromFloat creates an attr.Value using `typ` from a float64.

It is meant to be called through FromValue, not directly.

func FromInt

func FromInt(ctx