Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultTagName default tag name for the program to parse input struct tags // to build copier configuration. DefaultTagName = "copy" )
Variables ¶
View Source
var ( // ErrTypeInvalid returned when type of input var does not meet the requirement ErrTypeInvalid = errors.New("ErrTypeInvalid") // ErrTypeNonCopyable returned when the function can not perform copying between types ErrTypeNonCopyable = errors.New("ErrTypeNonCopyable") // ErrValueInvalid returned when input value does not meet the requirement ErrValueInvalid = errors.New("ErrValueInvalid") // ErrValueUnaddressable returned when value is `unaddressable` which is required // in some situations such as when accessing an unexported struct field. ErrValueUnaddressable = errors.New("ErrValueUnaddressable") // ErrFieldRequireCopying returned when a field is required to be copied // but no copying is done for it. ErrFieldRequireCopying = errors.New("ErrFieldRequireCopying") )
Errors may be returned from Copy function
Functions ¶
Types ¶
type Context ¶
type Context struct {
// CopyBetweenPtrAndValue allow or not copying between pointers and values (default is `true`)
CopyBetweenPtrAndValue bool
// CopyBetweenStructFieldAndMethod allow or not copying between struct fields and methods (default is `true`)
CopyBetweenStructFieldAndMethod bool
// IgnoreNonCopyableTypes ignore non-copyable types (default is `false`)
IgnoreNonCopyableTypes bool
// UseGlobalCache if false not use global cache (default is `true`)
UseGlobalCache bool
// contains filtered or unexported fields
}
Context copier context
type Option ¶
type Option func(ctx *Context)
Option configuration option function provided as extra arguments of copying function
func CopyBetweenPtrAndValue ¶
CopyBetweenPtrAndValue config function for setting flag `CopyBetweenPtrAndValue`
func CopyBetweenStructFieldAndMethod ¶
CopyBetweenStructFieldAndMethod config function for setting flag `CopyBetweenStructFieldAndMethod`
func IgnoreNonCopyableTypes ¶
IgnoreNonCopyableTypes config function for setting flag `IgnoreNonCopyableTypes`
func UseGlobalCache ¶
UseGlobalCache config function for setting flag `UseGlobalCache`
Click to show internal directories.
Click to hide internal directories.