deepcopier

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagName is the deepcopier struct tag name.
	TagName = "deepcopier"
	// FieldOptionName is the from field option name for struct tag.
	FieldOptionName = "field"
	// ContextOptionName is the context option name for struct tag.
	ContextOptionName = "context"
	// SkipOptionName is the skip option name for struct tag.
	SkipOptionName = "skip"
	// ForceOptionName is the skip option name for struct tag.
	ForceOptionName = "force"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeepCopier

type DeepCopier struct {
	// contains filtered or unexported fields
}

DeepCopier deep copies a struct to/from a struct.

func Copy

func Copy(src interface{}) *DeepCopier

Copy sets source or destination.

func (*DeepCopier) Exclude

func (dc *DeepCopier) Exclude(exclude []string) *DeepCopier

func (*DeepCopier) From

func (dc *DeepCopier) From(src interface{}) error

From sets the given the source as destination and destination as source.

func (*DeepCopier) Include

func (dc *DeepCopier) Include(include []string) *DeepCopier

func (*DeepCopier) To

func (dc *DeepCopier) To(dst interface{}) error

To sets the destination.

func (*DeepCopier) WithContext

func (dc *DeepCopier) WithContext(ctx map[string]interface{}) *DeepCopier

WithContext injects the given context into the builder instance.

type Options

type Options struct {
	// Context given to WithContext() method.
	Context map[string]interface{}
	// Reversed reverses struct tag checkings.
	Reversed bool
}

Options are copier options.

type TagOptions

type TagOptions map[string]string

TagOptions is a map that contains extracted struct tag options.

Jump to

Keyboard shortcuts

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