Documentation ¶
Index ¶
- func CtyMarshalableListVal[T CtyMarshalable](items []T) cty.Value
- func CtyMarshalableMapVal[T CtyMarshalable](m map[string]T) cty.Value
- func CtyMarshalableSliceMapVal[T CtyMarshalable](m map[string][]T) cty.Value
- func ListVal[F func(T) cty.Value, T any](f F, items ...T) cty.Value
- func MapVal[F func(T) cty.Value, T any](f F, m map[string]T) cty.Value
- func StringSliceListVal(items []string) cty.Value
- func StringSliceMapVal(m map[string][]string) cty.Value
- func Stringify(val cty.Value) string
- type CtyMarshalable
- type CtyTypeable
- type CtyValueMap
- type MapValToCtyValueFunc
- type UInt16Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtyMarshalableListVal ¶
func CtyMarshalableListVal[T CtyMarshalable](items []T) cty.Value
CtyMarshalableListVal turns a slice of CtyMarshalable items into a cty-compatible "list-value".
func CtyMarshalableMapVal ¶
func CtyMarshalableMapVal[T CtyMarshalable](m map[string]T) cty.Value
CtyMarshalableMapVal turns a map of CtyMarshalable slices into a cty-compatible "map-value".
func CtyMarshalableSliceMapVal ¶
func CtyMarshalableSliceMapVal[T CtyMarshalable](m map[string][]T) cty.Value
CtyMarshalableSliceMapVal turns a map of CtyMarshalable slices into a cty-compatible "map-value".
func ListVal ¶
ListVal turns a slice of items, which can be transformed to a cty.Value by way of the function f, into a cty-compatible "list-value".
func MapVal ¶
MapVal turns a map of items, which can be transformed to a cty.Value by way of the function f, into a cty-compatible "map-value".
func StringSliceListVal ¶
StringSliceListVal turns a slice of strings into a cty-compatible "list-value".
func StringSliceMapVal ¶
StringSliceMapVal turns a map of string-slices into a cty-compatible "map-value".
Types ¶
type CtyMarshalable ¶
CtyMarshalable implementors are expected to provide support for a cty-encoding.
type CtyTypeable ¶
type CtyTypeable interface { CtyMarshalable CtyType() cty.Type }
CtyTypeable implementors are expected to provide a cty.Type for an object to ve used with gocty.ToCtyValue, see also https://github.com/zclconf/go-cty/blob/main/docs/gocty.md
type CtyValueMap ¶
CtyValueMap is a simple type alias.
func AssignToMapVal ¶
func AssignToMapVal(mv CtyValueMap, mapValKey, attrKey string, attrVal cty.Value, f MapValToCtyValueFunc) CtyValueMap
AssignToMapVal assigns some attribute value to an attribute key in a value map either directly or under an optional map-key. If mv is not nil, attrVal's assignment is itself a MapVal, which is transformed to a cty.Value by f, typically either cty.ObjectVal or cty.MapVal.
A pseudo-code expression for this operation is: "mv[mapValKey] += f(mv[mapValKey] with mv[mapValKey][attrKey] = attrVal)"
If mv[mapValKey] is a map, then cty requires the attrVal to be "type-homogenous", see https://github.com/zclconf/go-cty/blob/main/docs/types.md#ctymap-types If mv[mapValKey] is an object, then attrVal can be of any type.
If the value map mv is nil, then a new MapVal is created and the return value will be different from mv. If mapValKey is empty, then attrVal is simply assigned to mv[attrKey].
type MapValToCtyValueFunc ¶
type MapValToCtyValueFunc func(CtyValueMap) cty.Value
MapValToCtyValueFunc ...
type UInt16Wrapper ¶
type UInt16Wrapper uint16
UInt16Wrapper is a convenience wrapper for the uint16 type.
func (UInt16Wrapper) CtyValue ¶
func (w UInt16Wrapper) CtyValue() cty.Value
implements the CtyMarshaler interface.