merge

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOverwrite

func WithOverwrite(dst interface{}, src interface{}) error

WithOverwrite encapsulates mergo's implementation of MergeWithOverwrite with our custom transformers.

Types

type BoolTransformer

type BoolTransformer struct{}

BoolTransformer will overwrite the behavior of merging boolean pointers such that a pointer to 'false' is not considered an empty value. Therefore, if the src's boolean pointer is not nil, it should overwrite the dst's boolean pointer value.

This is required because the default behavior of mergo is to treat a pointer to 'false' as an empty value, which prevents boolean fields to be set from 'true' to 'false' if needed.

func (BoolTransformer) Transformer

func (t BoolTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error

Jump to

Keyboard shortcuts

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