copier

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst any, options ...CopyOption) error

Copy copies fields from src to dst with optional configuration. The dst parameter must be a pointer to a struct.

Types

type CopyOption added in v0.18.0

type CopyOption func(option *copier.Option)

CopyOption configures the copy behavior.

func WithCaseInsensitive

func WithCaseInsensitive() CopyOption

WithCaseInsensitive enables case-insensitive field name matching.

func WithDeepCopy

func WithDeepCopy() CopyOption

WithDeepCopy enables deep copying of nested structures.

func WithFieldNameMapping

func WithFieldNameMapping(mappings ...FieldNameMapping) CopyOption

WithFieldNameMapping adds custom field name mappings.

func WithIgnoreEmpty

func WithIgnoreEmpty() CopyOption

WithIgnoreEmpty skips copying fields with zero values.

func WithTypeConverters

func WithTypeConverters(converters ...TypeConverter) CopyOption

WithTypeConverters adds custom type converters.

type FieldNameMapping added in v0.18.0

type FieldNameMapping = copier.FieldNameMapping

FieldNameMapping is an alias for copier.FieldNameMapping.

type Nullable added in v0.18.0

type Nullable[T any] interface {
	ValueOrZero() T
	Ptr() *T
}

Nullable defines the interface for null wrapper types.

type TypeConverter

type TypeConverter = copier.TypeConverter

TypeConverter is an alias for copier.TypeConverter.

Jump to

Keyboard shortcuts

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