package
0.5.1
Repository: https://github.com/awalterschulze/goderive.git
Documentation: pkg.go.dev

# README

The deriveDeepCopy function is a maintainable and fast way to implement fast deep copy functions.

Given the following input:

package deepcopy

type MyStruct struct {
	Int64     int64
	StringPtr *string
}

func (m *MyStruct) Clone() *MyStruct {
	if m == nil {
		return nil
	}
	n := &MyStruct{}
	deriveDeepCopy(n, m)
	return n
}

goderive will generate the following code:

// Code generated by goderive DO NOT EDIT.

package deepcopy

// deriveDeepCopy recursively copies the contents of src into dst.
func deriveDeepCopy(dst, src *MyStruct) {
	dst.Int64 = src.Int64
	if src.StringPtr == nil {
		dst.StringPtr = nil
	} else {
		dst.StringPtr = new(string)
		*dst.StringPtr = *src.StringPtr
	}
}

# Structs

No description provided by the author