mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
|
||||
// XXX/TODO: These types should be moved to the indexer package.
|
||||
|
||||
//go:generate mockery --case underscore --name TxIndexer
|
||||
|
||||
// TxIndexer interface defines methods to index and search transactions.
|
||||
type TxIndexer interface {
|
||||
// AddBatch analyzes, indexes and stores a batch of transactions.
|
||||
|
||||
108
state/txindex/mocks/tx_indexer.go
Normal file
108
state/txindex/mocks/tx_indexer.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Code generated by mockery v2.12.3. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
query "github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
|
||||
txindex "github.com/tendermint/tendermint/state/txindex"
|
||||
|
||||
types "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
// TxIndexer is an autogenerated mock type for the TxIndexer type
|
||||
type TxIndexer struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// AddBatch provides a mock function with given fields: b
|
||||
func (_m *TxIndexer) AddBatch(b *txindex.Batch) error {
|
||||
ret := _m.Called(b)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*txindex.Batch) error); ok {
|
||||
r0 = rf(b)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Get provides a mock function with given fields: hash
|
||||
func (_m *TxIndexer) Get(hash []byte) (*types.TxResult, error) {
|
||||
ret := _m.Called(hash)
|
||||
|
||||
var r0 *types.TxResult
|
||||
if rf, ok := ret.Get(0).(func([]byte) *types.TxResult); ok {
|
||||
r0 = rf(hash)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*types.TxResult)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func([]byte) error); ok {
|
||||
r1 = rf(hash)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Index provides a mock function with given fields: result
|
||||
func (_m *TxIndexer) Index(result *types.TxResult) error {
|
||||
ret := _m.Called(result)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*types.TxResult) error); ok {
|
||||
r0 = rf(result)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Search provides a mock function with given fields: ctx, q
|
||||
func (_m *TxIndexer) Search(ctx context.Context, q *query.Query) ([]*types.TxResult, error) {
|
||||
ret := _m.Called(ctx, q)
|
||||
|
||||
var r0 []*types.TxResult
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *query.Query) []*types.TxResult); ok {
|
||||
r0 = rf(ctx, q)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*types.TxResult)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, *query.Query) error); ok {
|
||||
r1 = rf(ctx, q)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
type NewTxIndexerT interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}
|
||||
|
||||
// NewTxIndexer creates a new instance of TxIndexer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
func NewTxIndexer(t NewTxIndexerT) *TxIndexer {
|
||||
mock := &TxIndexer{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
Reference in New Issue
Block a user