compare

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort added in v0.1.1

func Sort[T any](ts []T, cmp func(T, T) Order)

Types

type Compare

type Compare[T any] func(t1, t2 T) Order

func Asc

func Asc[T any](cmp Compare[T]) Compare[T]

func Combine

func Combine[T any](cmp ...Compare[T]) Compare[T]

func Desc

func Desc[T any](cmp Compare[T]) Compare[T]

type Order

type Order = int
const (
	Smaller Order = -1
	Equal   Order = 0
	Greater Order = 1
)

func Decimal added in v0.1.1

func Decimal(t1, t2 decimal.Decimal) Order

func Ordered

func Ordered[T constraints.Ordered](t1, t2 T) Order

func Time

func Time(t1, t2 time.Time) Order

Jump to

Keyboard shortcuts

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