mapper

package
v0.0.0-...-bd93019 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TerraformIDFieldName = "id"

TerraformIDFieldName is a special field name that can be used to identify the value that should be storedin/retrieved from the ID field in Terraform.

Variables

This section is empty.

Functions

func MapStructByTag

func MapStructByTag(src interface{}, tagName string) (map[string]interface{}, error)

MapStructByTag takes a struct and target tag name present on fields in that struct, then converts it into a map[string]interface{}. The target tag should be of the format `myTag:"destinationFieldName"`, where `destinationFieldName` is a valid map[string] key.

func MarshalMapToURLValues

func MarshalMapToURLValues(m map[string]string) url.Values

MarshalMapToURLValues creates a url.Values from a map[string]string

func MarshalToTerraform

func MarshalToTerraform(src interface{}, dest *schema.ResourceData, sm map[string]*schema.Schema) error

MarshalToTerraform takes a source struct (`src`), a destination Terraform *ResourceData (`dest`), and a Terraform schema map[string]*Schema and then marshals the source data into the destination data given a `terraform` tag present on the fields in the source struct.

func SimpleHashcode

func SimpleHashcode(v interface{}) int

SimpleHashcode calculates a simple integer hashcode by iterating over all the fields/keys in a map, concating the values in buffer, then calculating the hashcode of that buffer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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