utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(expected, received interface{}) *diff

Diff checks if expected is a subset of received with equal values. Empty or default values are ignored. Passed values must be pointers, otherwise it will error. Uses equality.Semantic for comparison, and runtime.UnstructuredConverter for map extraction. Troublesome behaviour:

  • When fields on expected are removed, this will return that they are equal. Technically, that is not the case as they are not equal since the fields got removed (changed). In order to check that case, you can use reflect.DeepEqual on those fields only.

func MergeMapsSrcDst

func MergeMapsSrcDst(from, to map[string]string)

MergeMapsSrcDst adds data from source to dest

func ObjectType

func ObjectType(obj interface{}) string

func UnsafeMapDiff

func UnsafeMapDiff(objA, objB interface{}) (diffValues, error)

UnsafeMapDiff just returns a diff between two objects. Must pass a reference. TODO: Resolve this for better usage by adding depth/recursive search

Types

This section is empty.

Jump to

Keyboard shortcuts

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