dsindex

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index represents a sortable dataset index, e.g. 1 < 1_1 < 1_1_1 < 1_2 < 2

func MustParse

func MustParse(value string) *Index

MustParse returns a dataset index from a string representation, panics on error

func Parse

func Parse(value string) (*Index, error)

Parse returns a dataset index from a string representation

func (*Index) Bump

func (idx *Index) Bump(before *Index) (*Index, error)

Bump returns the next index that is greater than the current one, but still less than the index provided in the parameter.

Bump doesn't increment the first, major segment of the index, it starts from the second segment instead.

func (*Index) Increment

func (idx *Index) Increment(segment int) (*Index, error)

Increment returns a new dataset index that is incremented by one in the specified segment

func (*Index) Length

func (idx *Index) Length() int

Length returns the number of segments in the dataset index

func (*Index) Less

func (idx *Index) Less(other *Index) bool

Less returns true if this dataset index is Less than the other dataset index

func (*Index) MustBump

func (idx *Index) MustBump(previous *Index) *Index

MustBump returns the next index that is greater than the current one, but still less than the index provided in the parameter. Panics on error

func (*Index) MustIncrement

func (idx *Index) MustIncrement(segment int) *Index

MustIncrement returns a new dataset index that is incremented by one in the specified segment, panics on error

func (*Index) String

func (idx *Index) String() string

String returns a string representation of the dataset index

Jump to

Keyboard shortcuts

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