transformers

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package transformers provide mergo transformers for Kubernetes objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TransformerMap

type TransformerMap map[reflect.Type]func(dst, src reflect.Value) error

TransformerMap is a mergo.Transformers implementation.

var PodSpec TransformerMap

PodSpec mergo transformers for corev1.PodSpec.

func (*TransformerMap) MergeListByKey

func (s *TransformerMap) MergeListByKey(key string, opts ...func(*mergo.Config)) func(_, _ reflect.Value) error

MergeListByKey merges two list by element key (eg. merge []corev1.Container by name). If mergo.WithAppendSlice options is passed, the list is extended, while elemnts with same name are merged. If not, the list is filtered to elements in src.

func (*TransformerMap) NilOtherFields

func (s *TransformerMap) NilOtherFields(opts ...func(*mergo.Config)) func(_, _ reflect.Value) error

NilOtherFields nils all fields not defined in src.

func (*TransformerMap) OverrideFields

func (s *TransformerMap) OverrideFields(fields ...string) func(_, _ reflect.Value) error

OverrideFields when merging override fields even if they are zero values (eg. nil or empty list).

func (TransformerMap) Transformer

func (s TransformerMap) Transformer(t reflect.Type) func(dst, src reflect.Value) error

Transformer implements mergo.Tansformers interface for TransformenrMap.

Jump to

Keyboard shortcuts

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