pagerange

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Last int = math.MaxInt

Variables

View Source
var All = MustNew(1, Last)

Functions

This section is empty.

Types

type Range

type Range struct {
	Lower, Upper int
}

Ranges are one-based and include the last page (e.g. {1,3} means page 1, 2 and 3). Upper may be Last to indicate all pages from lower to the last. If both values are Last only the last page is covered.

func MustNew

func MustNew(lower, upper int) Range

MustNew is like New but panics if the range is invalid.

func MustSingle

func MustSingle(n int) Range

MustSingle is like Single but panics if construction fails.

func New

func New(lower, upper int) (Range, error)

New creates a new page range.

func Single

func Single(n int) (Range, error)

Single returns a range for a single page.

func (Range) String

func (r Range) String() string

func (Range) Validate

func (r Range) Validate() error

Validate checks whether the range is valid.

Jump to

Keyboard shortcuts

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