gitlab.com/evatix-go/core@v1.3.55/bytetype/IsCompareResult.go (about)

     1  package bytetype
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/corecomparator"
     5  	"gitlab.com/evatix-go/core/internal/messages"
     6  )
     7  
     8  // IsCompareResult Here left is v, and right is `n`
     9  func (it Variant) IsCompareResult(n byte, compare corecomparator.Compare) bool {
    10  	switch compare {
    11  	case corecomparator.Equal:
    12  		return it.IsEqual(n)
    13  	case corecomparator.LeftGreater:
    14  		return it.IsGreater(n)
    15  	case corecomparator.LeftGreaterEqual:
    16  		return it.IsGreaterEqual(n)
    17  	case corecomparator.LeftLess:
    18  		return it.IsLess(n)
    19  	case corecomparator.LeftLessEqual:
    20  		return it.IsLessEqual(n)
    21  	case corecomparator.NotEqual:
    22  		return !it.IsEqual(n)
    23  	default:
    24  		panic(messages.ComparatorOutOfRangeMessage)
    25  	}
    26  }