Documentation ¶
Index ¶
- func Marshal(value interface{}) ([]byte, error)
- func MarshalForUpdate(plan interface{}, state interface{}) ([]byte, error)
- func MarshalRoot(value interface{}) ([]byte, error)
- func RegisterUnion(typ reflect.Type, discriminator string, variants ...UnionVariant)
- func Unmarshal(raw []byte, to any) error
- func UnmarshalComputed(raw []byte, to any) error
- func UnmarshalRoot(raw []byte, to any) error
- type TerraformUpdateBehavior
- type UnionVariant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshals the given data to a JSON string. For null values, omits the property entirely.
func MarshalForUpdate ¶
Marshals the given plan data to a JSON string. For null values, omits the property unless the corresponding state value was set.
func MarshalRoot ¶
func RegisterUnion ¶
func RegisterUnion(typ reflect.Type, discriminator string, variants ...UnionVariant)
func Unmarshal ¶
Unmarshal is similar to encoding/json.Unmarshal and parses the JSON-encoded data and stores it in the given pointer.
func UnmarshalComputed ¶
UnmarshalComputed is similar to Unmarshal, but leaves non-computed properties (e.g. required and optional) unchanged.
func UnmarshalRoot ¶
UnmarshalRoot is like Unmarshal, but doesn't try to call MarshalJSON on the root element. Useful if a struct's UnmarshalJSON is overrode to use the behavior of this encoder versus the standard library.
Types ¶
type TerraformUpdateBehavior ¶
type TerraformUpdateBehavior int
const ( // always update the property from JSON Always TerraformUpdateBehavior = iota // if the value is Null or Undefined, then update the value, otherwise skip IfUnset // always leave this property unchanged, but possibly update nested values OnlyNested )