compare

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package compare contains utilities for comparing Dogma entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparator

type Comparator interface {
	// MessageIsEqual returns true if a and b are equal.
	MessageIsEqual(a, b dogma.Message) bool

	// AggregateRootIsEqual returns true if a and b are equal.
	AggregateRootIsEqual(a, b dogma.AggregateRoot) bool

	// ProcessRootIsEqual returns true if a and b are equal.
	ProcessRootIsEqual(a, b dogma.ProcessRoot) bool
}

Comparator is an interface for comparing messages.

type DefaultComparator

type DefaultComparator struct{}

DefaultComparator is the default comparator implementation.

All values are using reflect.DeepEqual().

func (DefaultComparator) AggregateRootIsEqual

func (r DefaultComparator) AggregateRootIsEqual(a, b dogma.AggregateRoot) bool

AggregateRootIsEqual returns true if a and b are equal.

func (DefaultComparator) MessageIsEqual

func (r DefaultComparator) MessageIsEqual(a, b dogma.Message) bool

MessageIsEqual returns true if a and b are equal.

func (DefaultComparator) ProcessRootIsEqual

func (r DefaultComparator) ProcessRootIsEqual(a, b dogma.ProcessRoot) bool

ProcessRootIsEqual returns true if a and b are equal.

type TypeSimilarity

type TypeSimilarity uint64

TypeSimilarity measures the similarity between two types. The higher the number, the more similar the types are.

const (
	// SameTypes is a TypeSimilarity value indicating that two types are
	// identical.
	SameTypes TypeSimilarity = math.MaxUint64

	// UnrelatedTypes is a TypeSimilarity value that indicates that two types
	// are totally unrelated.
	UnrelatedTypes TypeSimilarity = 0
)

func FuzzyTypeComparison

func FuzzyTypeComparison(a, b reflect.Type) TypeSimilarity

FuzzyTypeComparison returns the "similarity" between two types.

Jump to

Keyboard shortcuts

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