Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTopNRows ¶
func GetTopNRows(ctx *sql.Context, iter sql.RowIter, sortConditions sql.SortConditions, n int64) ([]sql.Row, int64, error)
GetTopNRows uses a Top-N Heap Sort to find the top (min) N rows in a RowIter. It inserts each row of the iter into the max-heap, popping the max row if the size of the heap exceeds N such that the heap only contains the N min rows. At the end, it pops the contents of the heap and returns them in min-first order.
Types ¶
type RowSorter ¶
type RowSorter struct {
// contains filtered or unexported fields
}
RowSorter is a sorter implementation for Row slices using SortFields for the comparison
func NewRowSorter ¶
func NewRowSorter(ctx *sql.Context, sortConditions sql.SortConditions) *RowSorter
func NewRowSorterWithRows ¶
func (*RowSorter) CompareRows ¶
CompareRows compares rows a and b based on s.SortFields
func (*RowSorter) IsLesserRow ¶
IsLesserRow determines if sql.Row `a` is less than sql.Row `b` based off s.SortFields
Click to show internal directories.
Click to hide internal directories.