MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / GetRange

Method GetRange

tx_btree.go:726–745  ·  view source on GitHub ↗
(bucket string, key []byte, start, end int)

Source from the content-addressed store, hash-verified

724}
725
726func (tx *Tx) GetRange(bucket string, key []byte, start, end int) ([]byte, error) {
727 if start > end {
728 return nil, ErrStartGreaterThanEnd
729 }
730
731 value, err := tx.get(bucket, key)
732 if err != nil {
733 return nil, err
734 }
735
736 if start >= len(value) {
737 return nil, nil
738 }
739
740 if end >= len(value) {
741 return value[start:], nil
742 }
743
744 return value[start : end+1], nil
745}
746
747// loadValue in order to load value during pending and
748// stored items, we need this function to load value and

Callers 3

txGetRangeFunction · 0.80
getRangeFunction · 0.80

Calls 1

getMethod · 0.95

Tested by 2

txGetRangeFunction · 0.64