Documentation
¶
Index ¶
- func Between(startKey, endKey, key []byte) bool
- func BuildKeyRangeKey(startKey, endKey []byte) string
- func DecodeHTTPKeyRanges(input map[string]any) ([]string, error)
- func MaxKey(a, b []byte) []byte
- func MaxStartKey(a, b []byte) []byte
- func MinEndKey(a, b []byte) []byte
- func MinKey(a, b []byte) []byte
- type KeyRange
- type KeyRanges
- func (rs *KeyRanges) Append(startKey, endKey []byte)
- func (rs *KeyRanges) Delete(base *KeyRange)
- func (rs *KeyRanges) IsEmpty() bool
- func (rs *KeyRanges) Merge()
- func (rs *KeyRanges) Ranges() []*KeyRange
- func (rs *KeyRanges) SortAndDeduce()
- func (rs *KeyRanges) SubtractKeyRanges(base *KeyRange) []KeyRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Between ¶
Between returns true if startKey < key < endKey. If the key is empty and the boundary is right, the keys is infinite.
func BuildKeyRangeKey ¶
BuildKeyRangeKey build key for a keyRange
func DecodeHTTPKeyRanges ¶
DecodeHTTPKeyRanges decodes the key ranges from the HTTP request parameters.
func MaxStartKey ¶
MaxStartKey returns the bigger keys, the empty key is the biggest.
Types ¶
type KeyRange ¶
KeyRange is a key range.
func NewKeyRange ¶
NewKeyRange create a KeyRange with the given start key and end key.
func (*KeyRange) IsAdjacent ¶
IsAdjacent returns true if the two KeyRanges are adjacent.
func (*KeyRange) MarshalJSON ¶
MarshalJSON marshals to json.
func (*KeyRange) OverLapped ¶
OverLapped return true if the two KeyRanges are overlapped. if the two KeyRanges are continuous, it will also return true.
func (*KeyRange) UnmarshalJSON ¶
UnmarshalJSON unmarshals from json.
type KeyRanges ¶
type KeyRanges struct {
// contains filtered or unexported fields
}
KeyRanges is a slice of monotonically increasing KeyRange.
func NewKeyRangesWithSize ¶
NewKeyRangesWithSize creates a KeyRanges with the hint size.
func (*KeyRanges) SortAndDeduce ¶
func (rs *KeyRanges) SortAndDeduce()
SortAndDeduce sorts the KeyRanges and deduces the overlapped KeyRanges.
func (*KeyRanges) SubtractKeyRanges ¶
SubtractKeyRanges returns the KeyRanges that are not overlapped with the given KeyRange.