Documentation
¶
Index ¶
- Constants
- Variables
- func DropTables(ctx context.Context, db *bun.DB) error
- func Init(ctx context.Context, db *bun.DB) error
- func LogsUp(ctx context.Context, tx *bun.Tx) error
- func Migrate(ctx context.Context, db *bun.DB) error
- type IndexedRoundWithTip
- type Log
- type Storage
- func (s *Storage) DeleteLogs(ctx context.Context, startRound uint64, endRound uint64) error
- func (s *Storage) GetLastIndexedRound(ctx context.Context) (uint64, error)
- func (s *Storage) GetLastRetainedRound(ctx context.Context) (uint64, error)
- func (s *Storage) GetLogs(ctx context.Context, startRound, endRound uint64) ([]*Log, error)
- func (s *Storage) InsertLogs(ctx context.Context, values []*Log) error
- func (s *Storage) Upsert(ctx context.Context, value interface{}) error
- type Transaction
Constants ¶
const Continues string = "continues"
Continues is the latest Indexed Block Round.
const LastRetained string = "lastRetain"
LastRetained is the block with minimum height maintained.
Variables ¶
var Migrations *migrator.Migrations
Migrations are all migrations.
Functions ¶
func DropTables ¶
DropTables deletes all database tables in the `public` schema of the configured database.
Note: this method assumes that PostgresSQL is used as the underlying db.
Types ¶
type IndexedRoundWithTip ¶
type Log ¶
type Log struct {
Address string
Topics []string
Data string
Round uint64 // BlockNumber
BlockHash string
TxHash string `bun:",pk"`
TxIndex uint
Index uint `bun:",pk,allowzero"`
Removed bool
}
Log is the log representation in db.
type Storage ¶
Storage is a db storage helper wrapper.
Avoid depending on storage gateway types and methods as the migration should be immutable and work on the state of the previous migration. Whereas the existing storage type and methods will always be compatible with the most recent db version.
func (*Storage) DeleteLogs ¶
DeleteLogs deletes logs between rounds.
func (*Storage) GetLastIndexedRound ¶
GetLastIndexedRound returns latest indexed block round.
func (*Storage) GetLastRetainedRound ¶
GetLastRetainedRound returns the minimum round not pruned.
func (*Storage) InsertLogs ¶
InsertLogs inserts a batch of logs into the db.
type Transaction ¶
type Transaction struct {
Hash string `bun:",pk"`
Type uint8
Status uint // tx/receipt status
ChainID string
BlockHash string
Round uint64
Index uint32
Gas uint64
GasPrice string
GasTipCap string
GasFeeCap string
Nonce uint64
FromAddr string
ToAddr string
Value string
Data string
V, R, S string
}
Transaction is transaction representation in db.