sort

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 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[R record.Record] interface {
	Less(a, b R) 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[R record.Record](s Scalar[R]) By[R]

ByScalar create sorting by int64 values.

type ByWithOrder added in v0.1.0

type ByWithOrder[R record.Record] interface {
	By[R]
	// 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[R record.Record](by By[R]) ByWithOrder[R]

Asc wrap by for sorting in ASC (Ascending) direction.

func Desc added in v0.1.0

func Desc[R record.Record](by By[R]) ByWithOrder[R]

Desc wrap by for sorting in DESC (Descending) direction.

type Scalar added in v0.1.0

type Scalar[R record.Record] interface {
	Calc(item R) 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