cmp

package
v0.0.0-...-92f3e1a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b any, op string) error

func NewNotLesserThanError

func NewNotLesserThanError(left, right any) *notLesserThanError

NewNotLesserThanError creates a new notLesserThanError.

Types

type EqualError

type EqualError struct {
	Left  any
	Right any
}

EqualError is returned when two values are equal, but should not be.

func NewEqualError

func NewEqualError(left, right any) *EqualError

NewEqualError creates a new EqualError.

func (*EqualError) Error

func (e *EqualError) Error() string

Error returns the error message.

type NotEqualError

type NotEqualError struct {
	Left  any
	Right any
}

NotEqualError is returned when two values are not equal, but should be. For example, when comparing 1 to 2.

func NewNotEqualError

func NewNotEqualError(left, right any) *NotEqualError

NewNotEqualError creates a new NotEqualError.

func (*NotEqualError) Error

func (e *NotEqualError) Error() string

Error returns the error message.

type NotGreaterThanError

type NotGreaterThanError struct {
	Left  any
	Right any
}

NotGreaterThanError is returned when a value is not greater than another.

func NewNotGreaterThanError

func NewNotGreaterThanError(left, right any) *NotGreaterThanError

NewNotGreaterThanError creates a new NotGreaterThanError.

func (*NotGreaterThanError) Error

func (e *NotGreaterThanError) Error() string

Error returns the error message.

type NotGreaterThanOrEqualError

type NotGreaterThanOrEqualError struct {
	Left  any
	Right any
}

NotGreaterThanOrEqualError is returned when a value is not greater than or equal to another.

func NewNotGreaterThanOrEqualError

func NewNotGreaterThanOrEqualError(left, right any) *NotGreaterThanOrEqualError

NewNotGreaterThanOrEqualError creates a new NotGreaterThanOrEqualError.

func (*NotGreaterThanOrEqualError) Error

Error returns the error message.

type NotLesserThanOrEqualError

type NotLesserThanOrEqualError struct {
	Left  any
	Right any
}

NotLesserThanOrEqualError is returned when a value is not lesser than or equal to another.

func NewNotLesserThanOrEqualError

func NewNotLesserThanOrEqualError(left, right any) *NotLesserThanOrEqualError

NewNotLesserThanOrEqualError creates a new NotLesserThanOrEqualError.

func (*NotLesserThanOrEqualError) Error

func (e *NotLesserThanOrEqualError) Error() string

Error returns the error message.

type Operator

type Operator string
const (
	EQ  Operator = "=="
	NEQ Operator = "!="
	GT  Operator = ">"
	GTE Operator = ">="
	LT  Operator = "<"
	LTE Operator = "<="
)

type OperatorNotSupportedError

type OperatorNotSupportedError struct {
	Operator string
}

OperatorNotSupportedError is returned when an operator is not supported.

func NewOperatorNotSupportedError

func NewOperatorNotSupportedError(op string) *OperatorNotSupportedError

NewOperatorNotSupportedError creates a new OperatorNotSupportedError.

func (*OperatorNotSupportedError) Error

func (e *OperatorNotSupportedError) Error() string

Error returns the error message.

type TypeMismatchError

type TypeMismatchError struct {
	Expected any
	Actual   any
}

TypeMismatchError is returned when a type mismatch is detected. For example, when comparing a string to an integer.

func NewTypeMismatchError

func NewTypeMismatchError(expected, actual any) *TypeMismatchError

NewTypeMismatchError creates a new TypeMismatchError.

func (*TypeMismatchError) Error

func (e *TypeMismatchError) Error() string

Error returns the error message.

type TypeNotSupportedError

type TypeNotSupportedError struct {
	Type any
}

TypeNotSupportedError is returned when a type is not supported.

func NewTypeNotSupportedError

func NewTypeNotSupportedError(t any) *TypeNotSupportedError

NewTypeNotSupportedError creates a new TypeNotSupportedError.

func (*TypeNotSupportedError) Error

func (e *TypeNotSupportedError) Error() string

Error returns the error message.

Jump to

Keyboard shortcuts

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