comparators

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparatorAny

func ComparatorAny[T comparable](a, b T) int

ComparatorAny provides a comparison on any types

func ComparatorByte

func ComparatorByte(a, b byte) int

ComparatorByte provides a basic comparison on byte.

func ComparatorFloat32

func ComparatorFloat32(a, b float32) int

ComparatorFloat32 provides a basic comparison on float32.

func ComparatorFloat64

func ComparatorFloat64(a, b float64) int

ComparatorFloat64 provides a basic comparison on float64.

func ComparatorInt

func ComparatorInt(a, b int) int

ComparatorInt provides a basic comparison on int.

func ComparatorInt8

func ComparatorInt8(a, b int8) int

ComparatorInt8 provides a basic comparison on int8.

func ComparatorInt16

func ComparatorInt16(a, b int16) int

ComparatorInt16 provides a basic comparison on int16.

func ComparatorInt32

func ComparatorInt32(a, b int32) int

ComparatorInt32 provides a basic comparison on int32.

func ComparatorInt64

func ComparatorInt64(a, b int64) int

ComparatorInt64 provides a basic comparison on int64.

func ComparatorRune

func ComparatorRune(a, b rune) int

ComparatorRune provides a basic comparison on rune.

func ComparatorString

func ComparatorString(a, b string) int

ComparatorString provides a fast comparison on strings.

func ComparatorTime

func ComparatorTime(a, b time.Time) int

ComparatorTime provides a basic comparison on time.Time.

func ComparatorUint

func ComparatorUint(a, b uint) int

ComparatorUint provides a basic comparison on uint.

func ComparatorUint8

func ComparatorUint8(a, b uint8) int

ComparatorUint8 provides a basic comparison on uint8.

func ComparatorUint16

func ComparatorUint16(a, b uint16) int

ComparatorUint16 provides a basic comparison on uint16.

func ComparatorUint32

func ComparatorUint32(a, b uint32) int

ComparatorUint32 provides a basic comparison on uint32.

func ComparatorUint64

func ComparatorUint64(a, b uint64) int

ComparatorUint64 provides a basic comparison on uint64.

Types

type Comparator

type Comparator[T comparable] func(a, b T) int

Comparator is a function that compare a and b, and returns the result as int.

Should return a number:

negative , if a < b
zero     , if a == b
positive , if a > b

func Reverse

func Reverse[T comparable](comp Comparator[T]) Comparator[T]

type IComparable

type IComparable[T any] interface {
	Compare(other T) int
}

Jump to

Keyboard shortcuts

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