sorter

package
Version: v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiKeySorter

type MultiKeySorter struct {
	// List of  interfaces
	List []interface{}
	// contains filtered or unexported fields
}

MultiKeySorter implements the Sort interface, sorting the changes within. it will sort the array of interfaces based on ordered list

func OrderedBy

func OrderedBy(less ...lessFunc) *MultiKeySorter

OrderedBy returns a MultiKeySorter that sorts using the less functions, "in order". Call its Sort method to sort the data.

func (*MultiKeySorter) Len

func (ms *MultiKeySorter) Len() int

Len is part of sort.Interface. returns the length of list

func (*MultiKeySorter) Less

func (ms *MultiKeySorter) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by looping along the less functions until it finds a comparison that discriminates between the two items (one is less than the other).

func (*MultiKeySorter) Sort

func (ms *MultiKeySorter) Sort(List []interface{})

Sort sorts the list according to the less functions passed to OrderedBy.

func (*MultiKeySorter) Swap

func (ms *MultiKeySorter) Swap(i, j int)

Swap is part of sort.Interface. swaps the elements the list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL