sort

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type By

type By interface {
	Less(a, b record.Record) bool

	// String must return human readable format for debug
	String() string
}

By is base interface for sorting

func ByScalar added in v0.1.0

func ByScalar(s Scalar) By

ByScalar create sorting by int64 values

type ByWithOrder added in v0.1.0

type ByWithOrder interface {
	By
	// contains filtered or unexported methods
}

ByWithOrder wrapper for By interface with order (ASC/DESC) ByWithOrder can't be implemented in user level, use Asc() and Desc() for wrap By implementation

func Asc added in v0.1.0

func Asc(by By) ByWithOrder

Asc wrap by for sorting in ASC (Ascending) direction

func Desc added in v0.1.0

func Desc(by By) ByWithOrder

Desc wrap by for sorting in DESC (Descending) direction

type Scalar added in v0.1.0

type Scalar interface {
	Calc(item record.Record) int64
}

Scalar is a special case for sorting by comparing int64 values

Jump to

Keyboard shortcuts

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