Sha256: afe82cc046c8ceb576b3b4d65e097a505433ea1aadf95f87ad8812096b5b1c92

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

package awsutil

import (
	"reflect"
)

// DeepEqual returns if the two values are deeply equal like reflect.DeepEqual.
// In addition to this, this method will also dereference the input values if
// possible so the DeepEqual performed will not fail if one parameter is a
// pointer and the other is not.
//
// DeepEqual will not perform indirection of nested values of the input parameters.
func DeepEqual(a, b interface{}) bool {
	ra := reflect.Indirect(reflect.ValueOf(a))
	rb := reflect.Indirect(reflect.ValueOf(b))

	if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid {
		// If the elements are both nil, and of the same type the are equal
		// If they are of different types they are not equal
		return reflect.TypeOf(a) == reflect.TypeOf(b)
	} else if raValid != rbValid {
		// Both values must be valid to be equal
		return false
	}

	// Special casing for strings as typed enumerations are string aliases
	// but are not deep equal.
	if ra.Kind() == reflect.String && rb.Kind() == reflect.String {
		return ra.String() == rb.String()
	}

	return reflect.DeepEqual(ra.Interface(), rb.Interface())
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go