cmp

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByJSON

func ByJSON[T any](x, y T) (int, error)

func ByKey

func ByKey[S Sortable](x, y S) int

func Normalize

func Normalize(data any) error

func NormalizeSlice

func NormalizeSlice[S ~[]E, E any](slice S, cmp func(a, b E) int) S

func PermuteOrder

func PermuteOrder(data any, r *rand.Rand)

func PointerKey

func PointerKey[T Sortable](in *T) string

func SemanticEqual

func SemanticEqual[T Normalizer[T]](this, that T) (bool, error)

func SliceKey

func SliceKey[K Sortable](in []K) string

Types

type Normalizer

type Normalizer[T any] interface {
	Normalize() (T, error)
}

type Sortable

type Sortable interface {
	Key() string
}

Jump to

Keyboard shortcuts

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