* mainly sdk.int to cosmossdk.io/math * staking keys * fumpt * var-naming linter errors and a fumpt * Update CHANGELOG.md * Update .golangci.yml * Update CHANGELOG.md * Update test_helpers.go * Update test_helpers.go * fumpt and lint * this lints the db module, and makes it easier to use. It adds breaking name changes * DBConnection -> Connection * previous commit contained a merge error * Update test_helpers.go * Update test_helpers.go * db renamings * merge master * changelog * DBWriter -> Writer * consistent multistore reciever * standard recievers for multistore v2alpha1 * general cleanup of linting issues * more linter fixes * remove prealloc linter * nolint the secp256k1 import * nolint the secp256k1 package * completenolint resulting in a diff that has only nolints
25 lines
710 B
Go
25 lines
710 B
Go
package db
|
|
|
|
import (
|
|
dbm "github.com/cosmos/cosmos-sdk/db"
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
)
|
|
|
|
var _ = (*storetypes.Iterator)(nil)
|
|
|
|
type AsStoreIter struct {
|
|
dbm.Iterator
|
|
valid bool
|
|
}
|
|
|
|
// DBToStoreIterator returns an iterator wrapping the given iterator so that it satisfies the
|
|
// (store/types).Iterator interface.
|
|
func ToStoreIterator(source dbm.Iterator) *AsStoreIter {
|
|
ret := &AsStoreIter{Iterator: source}
|
|
ret.Next() // The DB iterator must be primed before it can access the first element, because Next also returns the validity status
|
|
return ret
|
|
}
|
|
|
|
func (it *AsStoreIter) Next() { it.valid = it.Iterator.Next() }
|
|
func (it *AsStoreIter) Valid() bool { return it.valid }
|