Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompareFn ¶
type CompareFn[E any] func(a E, b E, descending bool) CompareResult
CompareFn is compare function that compares the two given values according to multisort criteria.
The function is implemented for comparable data types inside this package. Use it!
It returns: - Less when a is smaller than b (on descending: b is smaller than a) - NotEqual when a is not equal to b - 0 when neither less or not equal is returned
type CompareResult ¶
type CompareResult int
const ( Less CompareResult = 1 NotEqual CompareResult = 2 )
func Compare ¶
func Compare[O constraints.Ordered](a O, b O, descending bool) CompareResult
Compare compares values according to multisort criteria.
func WithCompareFunc ¶ added in v0.10.2
func WithCompareFunc(f func() int, descending bool) CompareResult
WithCompareFunc compares input and returns a CompareResult according to multisort criteria.
type FieldMap ¶
FieldMap defines the fields that the sorter is capable to sort and provides the corresponsing compare funcs.
Click to show internal directories.
Click to hide internal directories.