sort

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Ascending  = Direction(false)
	Descending = Direction(true)
)

The possible sort directions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction bool

Direction defines the sort direction.

func (Direction) IsAscending

func (d Direction) IsAscending() bool

IsAscending returns true iff the sort direction is ascending.

func (Direction) IsDescending

func (d Direction) IsDescending() bool

IsDescending returns true iff the sort direction is descending.

func (Direction) String

func (d Direction) String() string

String returns a string description of the direction.

type Order

type Order struct {
	Key       string    // The key
	Direction Direction // The direction
}

Order describes the sort direction for a key.

func (Order) IsAscending

func (s Order) IsAscending() bool

IsAscending returns true iff the direction is ascending.

func (Order) IsDescending

func (s Order) IsDescending() bool

IsDescending returns true iff the direction is descending.

func (Order) IsValid

func (s Order) IsValid() (bool, error)

IsValid returns true if and only if the key satisfies record.IsKey.

func (Order) String

func (s Order) String() string

String returns a string description of the sort.

type OrderBy

type OrderBy []Order

OrderBy represents a slice of sort orders.

func By

func By(s ...Order) OrderBy

By returns the OrderBy slice described by the given Order terms.

func (OrderBy) IsValid

func (S OrderBy) IsValid() (bool, error)

IsValid validates the OrderBy.

func (OrderBy) String

func (S OrderBy) String() string

String returns a string description.

Jump to

Keyboard shortcuts

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