本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2KB

  1. package store
  2. import (
  3. "github.com/lunny/nodb/store/driver"
  4. )
  5. type Tx struct {
  6. driver.Tx
  7. }
  8. func (tx *Tx) NewIterator() *Iterator {
  9. it := new(Iterator)
  10. it.it = tx.Tx.NewIterator()
  11. return it
  12. }
  13. func (tx *Tx) NewWriteBatch() WriteBatch {
  14. return tx.Tx.NewWriteBatch()
  15. }
  16. func (tx *Tx) RangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator {
  17. return NewRangeLimitIterator(tx.NewIterator(), &Range{min, max, rangeType}, &Limit{0, -1})
  18. }
  19. func (tx *Tx) RevRangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator {
  20. return NewRevRangeLimitIterator(tx.NewIterator(), &Range{min, max, rangeType}, &Limit{0, -1})
  21. }
  22. //count < 0, unlimit.
  23. //
  24. //offset must >= 0, if < 0, will get nothing.
  25. func (tx *Tx) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator {
  26. return NewRangeLimitIterator(tx.NewIterator(), &Range{min, max, rangeType}, &Limit{offset, count})
  27. }
  28. //count < 0, unlimit.
  29. //
  30. //offset must >= 0, if < 0, will get nothing.
  31. func (tx *Tx) RevRangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator {
  32. return NewRevRangeLimitIterator(tx.NewIterator(), &Range{min, max, rangeType}, &Limit{offset, count})
  33. }
上海开阖软件有限公司 沪ICP备12045867号-1