copystructure

package
v0.5.0-rc1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: MIT, MPL-2.0 Imports: 3 Imported by: 0

README

copystructure

copystructure is a Go library for deep copying values in Go.

This allows you to copy Go values that may contain reference values such as maps, slices, or pointers, and copy their data as well instead of just their references.

Installation

Standard go get:

$ go get github.com/mitchellh/copystructure

Usage & Example

For usage and examples see the Godoc.

The Copy function has examples associated with it there.

Documentation

Index

Constants

This section is empty.

Variables

Copiers is a map of types that behave specially when they are copied. If a type is found in this map while deep copying, this function will be called to copy it instead of attempting to copy all fields.

The key should be the type, obtained using: reflect.TypeOf(value with type).

It is unsafe to write to this map after Copies have started. If you are writing to this map while also copying, wrap all modifications to this map as well as to Copy in a mutex.

Functions

func Copy

func Copy(v interface{}) (interface{}, error)

Copy returns a deep copy of v.

Types

type CopierFunc

type CopierFunc func(interface{}) (interface{}, error)

CopierFunc is a function that knows how to deep copy a specific type. Register these globally with the Copiers variable.

Jump to

Keyboard shortcuts

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