Documentation ¶
Index ¶
- func IsErrNotFound[K any](err error) bool
- type ByteSpan
- type ErrNotFound
- type Span
- func (s Span[T]) Compare(x T, cmp func(a, b T) int) int
- func (s Span[T]) Contains(x T, cmp func(a, b T) int) bool
- func (s Span[T]) IncludesLower() bool
- func (s Span[T]) IncludesUpper() bool
- func (s Span[T]) IsDesc() bool
- func (s Span[T]) LowerBound() (T, bool)
- func (s Span[T]) String() string
- func (s Span[T]) UpperBound() (T, bool)
- func (s Span[T]) WithLowerExcl(x T) Span[T]
- func (s Span[T]) WithLowerIncl(x T) Span[T]
- func (s Span[T]) WithUpperExcl(x T) Span[T]
- func (s Span[T]) WithUpperIncl(x T) Span[T]
- func (s Span[T]) WithoutLower() Span[T]
- func (s Span[T]) WithoutUpper() Span[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrNotFound ¶
Types ¶
type ByteSpan ¶
ByteSpan represents a lexicographically sorted span of []byte. The span is [Begin, End), meaning Begin is included, and End is excluded. End is ignored if set to nil, and the span is assumed to have no upper bound. When Begin is the empty []byte, it implies no lower bound, since it is inclusive.
type ErrNotFound ¶
type ErrNotFound[K any] struct { Key K }
func (ErrNotFound[K]) Error ¶
func (e ErrNotFound[K]) Error() string
type Span ¶
type Span[T any] struct { // contains filtered or unexported fields }
Span is a specification for iteration through values of type T. It includes begin and end bounds, which can be inclusive or exclusive of the bounding value. The empty Span is equivalent to TotalSpan() and includes all elements of type T.
func (Span[T]) Compare ¶
Compare determines if an element T is below the Span, in the Span or above the Span. The output should be interpretted as s - x. Similar to bytes.Compare and strings.Compare. If the span > x then 1. If the span < x then -1. If the span contains x then 0.
func (Span[T]) IncludesLower ¶
IncludesLower returns true if there is a lower bound and it is inclusive
func (Span[T]) IncludesUpper ¶
IncludesUpper returns true if there is an upper bound and it is inclusive
func (Span[T]) LowerBound ¶
LowerBound returns the Span's lower bound and true if the span has a lower bound.
func (Span[T]) UpperBound ¶
UpperBound returns the Span's upper bound and true if the span has an upper bound.
func (Span[T]) WithLowerExcl ¶
WithLower returns a copy of s with an exclusive lower bound.
func (Span[T]) WithLowerIncl ¶
WithLowerIncl returns a copy of s with an inclusive lower bound
func (Span[T]) WithUpperExcl ¶
WithLowerExcl returns a copy of s with an exclusive lower bound
func (Span[T]) WithUpperIncl ¶
WithUpperIncl returns a copy of s with an inclusive upper bound
func (Span[T]) WithoutLower ¶
WithoutLower returns a copy of s with no lower bound.
func (Span[T]) WithoutUpper ¶
WithoutUpper returns a copy of s with no upper bound.