MCPcopy
hub / github.com/hashicorp/go-memdb / Get

Method Get

txn.go:744–759  ·  view source on GitHub ↗

Get is used to construct a ResultIterator over all the rows that match the given constraints of an index. The index values must match exactly (this is not a range-based or prefix-based lookup) by default. Prefix lookups: if the named index implements PrefixIndexer, you may perform prefix-based look

(table, index string, args ...interface{})

Source from the content-addressed store, hash-verified

742// See the documentation for ResultIterator to understand the behaviour of the
743// returned ResultIterator.
744func (txn *Txn) Get(table, index string, args ...interface{}) (ResultIterator, error) {
745 indexIter, val, err := txn.getIndexIterator(table, index, args...)
746 if err != nil {
747 return nil, err
748 }
749
750 // Seek the iterator to the appropriate sub-set
751 watchCh := indexIter.SeekPrefixWatch(val)
752
753 // Create an iterator
754 iter := &radixIterator{
755 iter: indexIter,
756 watchCh: watchCh,
757 }
758 return iter, nil
759}
760
761// GetReverse is used to construct a Reverse ResultIterator over all the
762// rows that match the given constraints of an index.

Callers 15

DeletePrefixMethod · 0.95
DeleteAllMethod · 0.95
readableIndexMethod · 0.80
writableIndexMethod · 0.80
InsertMethod · 0.80
DeleteMethod · 0.80
TestMemDB_IsolationFunction · 0.80
TestTxn_InsertGet_SimpleFunction · 0.80
TestTxn_DeletePrefixFunction · 0.80
verifyNoResultsFunction · 0.80
TestTxn_InsertGet_PrefixFunction · 0.80
TestTxn_GetIterAndDeleteFunction · 0.80

Calls 1

getIndexIteratorMethod · 0.95

Tested by 9

TestMemDB_IsolationFunction · 0.64
TestTxn_InsertGet_SimpleFunction · 0.64
TestTxn_DeletePrefixFunction · 0.64
verifyNoResultsFunction · 0.64
TestTxn_InsertGet_PrefixFunction · 0.64
TestTxn_GetIterAndDeleteFunction · 0.64
TestComplexDBFunction · 0.64
TestWatchUpdateFunction · 0.64
TestFilterIteratorFunction · 0.64