awsutil

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2015 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dst, src interface{})

Copy deeply copies a src structure to dst. Useful for copying request and response structures.

Example
package main

import (
	"fmt"

	"github.com/awslabs/aws-sdk-go/aws/awsutil"
)

func main() {
	type Foo struct {
		A int
		B []*string
	}

	// Create the initial value
	str1 := "hello"
	str2 := "bye bye"
	f1 := &Foo{A: 1, B: []*string{&str1, &str2}}

	// Do the copy
	var f2 Foo
	awsutil.Copy(&f2, f1)

	// Print the result
	fmt.Println(awsutil.StringValue(f2))

}
Output:

{
  A: 1,
  B: ["hello","bye bye"]
}

func CopyOf

func CopyOf(src interface{}) (dst interface{})

CopyOf returns a copy of src while also allocating the memory for dst. src must be a pointer type or this operation will fail.

Example
package main

import (
	"fmt"

	"github.com/awslabs/aws-sdk-go/aws/awsutil"
)

func main() {
	type Foo struct {
		A int
		B []*string
	}

	// Create the initial value
	str1 := "hello"
	str2 := "bye bye"
	f1 := &Foo{A: 1, B: []*string{&str1, &str2}}

	// Do the copy
	v := awsutil.CopyOf(f1)
	var f2 *Foo = v.(*Foo)

	// Print the result
	fmt.Println(awsutil.StringValue(f2))

}
Output:

{
  A: 1,
  B: ["hello","bye bye"]
}

func SetValueAtPath

func SetValueAtPath(i interface{}, path string, v interface{})

SetValueAtPath sets an object at the lexical path inside of a structure

func StringValue

func StringValue(i interface{}) string

func ValuesAtPath

func ValuesAtPath(i interface{}, path string) []interface{}

ValuesAtPath returns a list of objects at the lexical path inside of a structure

Types

This section is empty.

Jump to

Keyboard shortcuts

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