db

package
v0.0.0-...-af7e402 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB)

AutoMigrate will migrate the schema for you

func ConnectDB

func ConnectDB(config *env.Config)

ConnectDB connects to the database

func InsertObj

func InsertObj(db *gorm.DB, objects []BlockChainLog) error

PopulateDB populates the database with the latest block number

Types

type BlockChainLog

type BlockChainLog struct {
	Address     string `gorm:"column:address"`
	BlockHash   string `gorm:"column:block_hash"`
	BlockNumber string `gorm:"column:block_number"`
	Data        string `gorm:"column:data"`
	GasPrice    string `gorm:"column:gas_price"`
	GasUsed     string `gorm:"column:gas_used"`
	LogIndex    string `gorm:"column:log_index"`
	TimeStamp   string `gorm:"column:time_stamp"`
	// Topics      []string `gorm:"column:topics"`
	Topics datatypes.JSON `gorm:"column:topics"`
	// ID     uint   `gorm:"primary_key"`
	TransactionHash  string `gorm:"column:transaction_hash;primary_key"`
	TransactionIndex string `gorm:"column:transaction_index"`
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL