Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Map ¶
func Map[K, V Copy](src map[K]V) map[K]V
Map shallowly clones a map. The returned map is never nil.
func Slice ¶
func Slice[T Copy](src []T) []T
// Deep recursively clones an item of any kind. This uses reflection to traverse lists, etc. // It will panic if it hits a loop. Don't use this in prod.
func Deep[V any](src V) (dst V) { return deep(reflect.ValueOf(src), 0).Interface().(V) }
Slice shallowly clones a slice. The new slice is never nil.
Types ¶
type Copy ¶
type Copy interface { ~string | constraints.Complex | constraints.Integer | ~bool | constraints.Float }
Copy types are primitives and copied during assignment.
Click to show internal directories.
Click to hide internal directories.