Documentation ¶
Overview ¶
Utilities for working with and manipulating structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFunc ¶
func CopyFunc(dest interface{}, source interface{}, fn StructValueFunc) error
func CopyNonZero ¶
func CopyNonZero(dest interface{}, source interface{}) error
Copy all values from the source into the destination, provided the source value for the corresponding field is not that type's zero value.
Types ¶
type StructValueFunc ¶
type StructValueFunc func(field string, sourceValue interface{}, destValue interface{}) (interface{}, bool)
Receives a struct field name, the value of that field in the source struct, and the value for that field in the destination struct. Returns the value that should be placed in the destination struct fields. If the returned bool is false, no changes will be made.
Click to show internal directories.
Click to hide internal directories.