Skip to content
Snippets Groups Projects
Commit 024ba500 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Added IsEqual function

parent 86923d94
No related branches found
No related tags found
No related merge requests found
package utils
import (
"bytes"
"github.com/mohae/deepcopy"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/string_utils"
"net/mail"
"net/url"
"os"
"reflect"
"regexp"
"strings"
)
......@@ -145,3 +147,26 @@ func EscapeOpenSearchSearchString(str string) string {
}
return searchString
}
// IsEqual returns if the two objects are equal
func IsEqual(expected interface{}, actual interface{}) bool {
if expected == nil || actual == nil {
return expected == actual
}
if exp, ok := expected.([]byte); ok {
act, ok := actual.([]byte)
if !ok {
return false
}
if exp == nil || act == nil {
return true
}
return bytes.Equal(exp, act)
}
return reflect.DeepEqual(expected, actual)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment