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.
type FieldMap ¶
FieldMap defines the fields that the sorter is capable to sort and provides the corresponsing compare funcs.
type Sorter ¶
type Sorter[E any] struct { // contains filtered or unexported fields }
Sorter can sort by multiple criteria.
func (*Sorter[E]) AvailableKeys ¶
AvailableKeys returns the available sort keys that this sorter has been initialized with.