dbiter

package
v0.0.0-...-88dbf4e Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package dbiter provides the interal DB iterator implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator[T any] interface {
	// Key returns the key at the index of the iterator.
	// The returned key is immutable and must not be changed!
	//
	// A mutable key can be retrieved by cloning the key.
	Key() typact.Option[rel.Key]
	// Value returns the value at the index of the iterator.,
	// The returned value is immutable and must not be changed!
	//
	// A mutable value can be retrieved by cloning the value.
	Value() typact.Option[[]byte]

	Next() bool

	IsValid() bool
}

Iterator defines the methods of a iterator.

type MergeIterator

type MergeIterator[T any] struct {
	// contains filtered or unexported fields
}

MergeIterator is an iterator over multiple iterators. If the same key occurs multiple times in some iterators, the one with the smalest indx is prefered.

func NewMergeIterator

func NewMergeIterator[T any](iters ...Iterator[T]) *MergeIterator[T]

NewMergeIterator returns an initialized MergeIterator.

func (*MergeIterator[T]) IsValid

func (m *MergeIterator[T]) IsValid() bool

IsValid returns whether the current iterator in m is valid.

func (*MergeIterator[T]) Key

func (m *MergeIterator[T]) Key() typact.Option[rel.Key]

func (*MergeIterator[T]) Next

func (m *MergeIterator[T]) Next() bool

Next moves over to the next element in the iterator. If the next element could be retrieved, true is returned. Otherwise false is returned.

func (*MergeIterator[T]) Value

func (m *MergeIterator[T]) Value() typact.Option[[]byte]

Jump to

Keyboard shortcuts

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