github.com/devwanda/aphelion-staking@v0.33.9/state/txindex/null/null.go (about) 1 package null 2 3 import ( 4 "context" 5 "errors" 6 7 "github.com/devwanda/aphelion-staking/libs/pubsub/query" 8 "github.com/devwanda/aphelion-staking/state/txindex" 9 "github.com/devwanda/aphelion-staking/types" 10 ) 11 12 var _ txindex.TxIndexer = (*TxIndex)(nil) 13 14 // TxIndex acts as a /dev/null. 15 type TxIndex struct{} 16 17 // Get on a TxIndex is disabled and panics when invoked. 18 func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) { 19 return nil, errors.New(`indexing is disabled (set 'tx_index = "kv"' in config)`) 20 } 21 22 // AddBatch is a noop and always returns nil. 23 func (txi *TxIndex) AddBatch(batch *txindex.Batch) error { 24 return nil 25 } 26 27 // Index is a noop and always returns nil. 28 func (txi *TxIndex) Index(result *types.TxResult) error { 29 return nil 30 } 31 32 func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*types.TxResult, error) { 33 return []*types.TxResult{}, nil 34 }