corecomparator

package
v1.3.55 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CompareNames = [...]string{
		Equal:            "Equal",
		LeftGreater:      "LeftGreater",
		LeftGreaterEqual: "LeftGreaterEqual",
		LeftLess:         "LeftLess",
		LeftLessEqual:    "LeftLessEqual",
		NotEqual:         "NotEqual",
		Inconclusive:     "Inconclusive",
	}

	CompareOperatorsSymbols = [...]string{
		Equal:            "=",
		LeftGreater:      ">",
		LeftGreaterEqual: ">=",
		LeftLess:         "<",
		LeftLessEqual:    "<=",
		NotEqual:         "!=",
		Inconclusive:     "?!",
	}

	CompareOperatorsShotNames = [...]string{
		Equal:            "eq",
		LeftGreater:      "gt",
		LeftGreaterEqual: "ge",
		LeftLess:         "lt",
		LeftLessEqual:    "le",
		NotEqual:         "ne",
		Inconclusive:     "i",
	}

	SqlCompareOperators = [...]string{
		Equal:            "=",
		LeftGreater:      ">",
		LeftGreaterEqual: ">=",
		LeftLess:         "<",
		LeftLessEqual:    "<=",
		NotEqual:         "<>",
		Inconclusive:     "i",
	}

	RangesMap = map[string]Compare{
		Equal.Name():                         Equal,
		LeftGreater.Name():                   LeftGreater,
		LeftGreaterEqual.Name():              LeftGreaterEqual,
		LeftLess.Name():                      LeftLess,
		LeftLessEqual.Name():                 LeftLessEqual,
		NotEqual.Name():                      NotEqual,
		Inconclusive.Name():                  Inconclusive,
		Equal.NumberString():                 Equal,
		LeftGreater.NumberString():           LeftGreater,
		LeftGreaterEqual.NumberString():      LeftGreaterEqual,
		LeftLess.NumberString():              LeftLess,
		LeftLessEqual.NumberString():         LeftLessEqual,
		NotEqual.NumberString():              NotEqual,
		Inconclusive.NumberString():          Inconclusive,
		Equal.NumberJsonString():             Equal,
		LeftGreater.NumberJsonString():       LeftGreater,
		LeftGreaterEqual.NumberJsonString():  LeftGreaterEqual,
		LeftLess.NumberJsonString():          LeftLess,
		LeftLessEqual.NumberJsonString():     LeftLessEqual,
		NotEqual.NumberJsonString():          NotEqual,
		Inconclusive.NumberJsonString():      Inconclusive,
		Equal.OperatorSymbol():               Equal,
		LeftGreater.OperatorSymbol():         LeftGreater,
		LeftGreaterEqual.OperatorSymbol():    LeftGreaterEqual,
		LeftLess.OperatorSymbol():            LeftLess,
		LeftLessEqual.OperatorSymbol():       LeftLessEqual,
		NotEqual.OperatorSymbol():            NotEqual,
		Inconclusive.OperatorSymbol():        Inconclusive,
		Equal.OperatorShortForm():            Equal,
		LeftGreater.OperatorShortForm():      LeftGreater,
		LeftGreaterEqual.OperatorShortForm(): LeftGreaterEqual,
		LeftLess.OperatorShortForm():         LeftLess,
		LeftLessEqual.OperatorShortForm():    LeftLessEqual,
		NotEqual.OperatorShortForm():         NotEqual,
		Inconclusive.OperatorShortForm():     Inconclusive,
	}
)

Functions

func MinLength added in v0.8.3

func MinLength(left, right int) (min int)

func RangeNamesCsv added in v1.2.1

func RangeNamesCsv() string

func Ranges added in v0.4.1

func Ranges() []string

Types

type BaseIsCaseSensitive added in v0.8.0

type BaseIsCaseSensitive struct {
	IsCaseSensitive bool `json:"IsCaseSensitive,omitempty"` // strict case compare
}

func (*BaseIsCaseSensitive) BaseIsIgnoreCase added in v0.8.0

func (it *BaseIsCaseSensitive) BaseIsIgnoreCase() BaseIsIgnoreCase

func (BaseIsCaseSensitive) Clone added in v0.9.5

func (*BaseIsCaseSensitive) ClonePtr added in v0.9.5

func (it *BaseIsCaseSensitive) ClonePtr() *BaseIsCaseSensitive

func (*BaseIsCaseSensitive) IsIgnoreCase added in v0.8.0

func (it *BaseIsCaseSensitive) IsIgnoreCase() bool

type BaseIsIgnoreCase added in v0.8.0

type BaseIsIgnoreCase struct {
	IsIgnoreCase bool `json:"IsCaseSensitive,omitempty"` // ignore case compare
}

func (*BaseIsIgnoreCase) BaseIsCaseSensitive added in v0.8.0

func (it *BaseIsIgnoreCase) BaseIsCaseSensitive() BaseIsCaseSensitive

func (BaseIsIgnoreCase) Clone added in v0.9.5

func (*BaseIsIgnoreCase) ClonePtr added in v0.9.5

func (it *BaseIsIgnoreCase) ClonePtr() *BaseIsIgnoreCase

func (*BaseIsIgnoreCase) IsCaseSensitive added in v0.8.0

func (it *BaseIsIgnoreCase) IsCaseSensitive() bool

type Compare

type Compare byte
const (
	Equal Compare = iota
	LeftGreater
	LeftGreaterEqual
	LeftLess
	LeftLessEqual
	NotEqual
	Inconclusive
)

func Max

func Max() Compare

func Min

func Min() Compare

func (Compare) CsvString added in v0.9.5

func (it Compare) CsvString(values ...Compare) string

func (Compare) CsvStrings added in v0.9.5

func (it Compare) CsvStrings(values ...Compare) []string

func (Compare) Format added in v1.2.1

func (it Compare) Format(format string) (compiled string)

func (Compare) Is

func (it Compare) Is(other Compare) bool

func (Compare) IsAnyNamesOf added in v1.2.3

func (it Compare) IsAnyNamesOf(names ...string) bool

func (Compare) IsAnyOf added in v0.8.3

func (it Compare) IsAnyOf(values ...Compare) bool

func (Compare) IsCompareEqualLogically added in v1.3.16

func (it Compare) IsCompareEqualLogically(
	expectedCompare Compare,
) bool

func (Compare) IsDefined added in v1.3.16

func (it Compare) IsDefined() bool

func (Compare) IsDefinedPlus added in v1.3.16

func (it Compare) IsDefinedPlus(right Compare) bool

IsDefinedPlus

return  it != Inconclusive && it == right

func (Compare) IsDefinedProperly added in v0.8.3

func (it Compare) IsDefinedProperly() bool

func (Compare) IsEqual

func (it Compare) IsEqual() bool

func (Compare) IsGreater added in v1.2.1

func (it Compare) IsGreater() bool

func (Compare) IsGreaterEqual added in v1.2.1

func (it Compare) IsGreaterEqual() bool

func (Compare) IsInconclusive added in v0.8.3

func (it Compare) IsInconclusive() bool

func (Compare) IsInconclusiveOrNotEqual added in v0.8.3

func (it Compare) IsInconclusiveOrNotEqual() bool

func (Compare) IsInvalid added in v1.2.1

func (it Compare) IsInvalid() bool

func (Compare) IsLeftGreater

func (it Compare) IsLeftGreater() bool

func (Compare) IsLeftGreaterEqual

func (it Compare) IsLeftGreaterEqual() bool

func (Compare) IsLeftGreaterEqualLogically added in v1.3.16

func (it Compare) IsLeftGreaterEqualLogically() bool

IsLeftGreaterEqualLogically

it == Equal || it == LeftGreater || it == LeftGreaterEqual

func (Compare) IsLeftGreaterOrGreaterEqualOrEqual added in v0.8.3

func (it Compare) IsLeftGreaterOrGreaterEqualOrEqual() bool

IsLeftGreaterOrGreaterEqualOrEqual

it == Equal || it == LeftGreater || it == LeftGreaterEqual

func (Compare) IsLeftLess

func (it Compare) IsLeftLess() bool

func (Compare) IsLeftLessEqual

func (it Compare) IsLeftLessEqual() bool

func (Compare) IsLeftLessEqualLogically added in v1.3.16

func (it Compare) IsLeftLessEqualLogically() bool

IsLeftLessEqualLogically

it == Equal || it == LeftLess || it == LeftLessEqual

func (Compare) IsLeftLessOrLessEqualOrEqual added in v0.8.3

func (it Compare) IsLeftLessOrLessEqualOrEqual() bool

IsLeftLessOrLessEqualOrEqual

it == Equal || it == LeftLess || it == LeftLessEqual

func (Compare) IsLess added in v1.2.1

func (it Compare) IsLess() bool

func (Compare) IsLessEqual added in v1.2.1

func (it Compare) IsLessEqual() bool

func (Compare) IsNameEqual added in v1.2.1

func (it Compare) IsNameEqual(name string) bool

func (Compare) IsNotEqual added in v0.3.8

func (it Compare) IsNotEqual() bool

func (Compare) IsNotEqualLogically added in v0.8.3

func (it Compare) IsNotEqualLogically() bool

IsNotEqualLogically

return it != Equal

func (Compare) IsNotInconclusive added in v0.8.3

func (it Compare) IsNotInconclusive() bool

func (Compare) IsValid added in v1.2.1

func (it Compare) IsValid() bool

func (Compare) IsValueEqual added in v1.2.1

func (it Compare) IsValueEqual(value byte) bool

func (Compare) MarshalJSON added in v0.8.3

func (it Compare) MarshalJSON() ([]byte, error)

func (Compare) Name added in v0.8.3

func (it Compare) Name() string

func (Compare) NameValue added in v0.9.5

func (it Compare) NameValue() string

func (Compare) NumberJsonString added in v0.8.3

func (it Compare) NumberJsonString() string

func (Compare) NumberString added in v0.8.3

func (it Compare) NumberString() string

func (Compare) OnlySupportedDirectErr added in v0.9.5

func (it Compare) OnlySupportedDirectErr(
	onlySupportedCompares ...Compare,
) error

func (Compare) OnlySupportedErr added in v0.9.5

func (it Compare) OnlySupportedErr(
	message string,
	onlySupportedCompares ...Compare,
) error

func (Compare) OperatorShortForm added in v0.8.3

func (it Compare) OperatorShortForm() string

func (Compare) OperatorSymbol added in v0.8.3

func (it Compare) OperatorSymbol() string

func (Compare) RangeNamesCsv added in v1.2.1

func (it Compare) RangeNamesCsv() string

func (Compare) SqlOperatorSymbol added in v0.8.3

func (it Compare) SqlOperatorSymbol() string

func (Compare) String

func (it Compare) String() string

func (Compare) StringValue

func (it Compare) StringValue() string

func (Compare) ToNumberString added in v1.2.1

func (it Compare) ToNumberString() string

func (*Compare) UnmarshalJSON added in v0.8.3

func (it *Compare) UnmarshalJSON(data []byte) error

func (Compare) Value

func (it Compare) Value() byte

func (Compare) ValueByte added in v1.2.1

func (it Compare) ValueByte() byte

func (Compare) ValueInt added in v1.2.1

func (it Compare) ValueInt() int

func (Compare) ValueInt16 added in v1.2.1

func (it Compare) ValueInt16() int16

func (Compare) ValueInt32 added in v1.2.1

func (it Compare) ValueInt32() int32

func (Compare) ValueInt8 added in v1.2.1

func (it Compare) ValueInt8() int8

func (Compare) ValueString added in v1.2.1

func (it Compare) ValueString() string

Jump to

Keyboard shortcuts

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