Documentation ¶
Index ¶
- type Queries
- type SQLDB
- func (db *SQLDB) CleanTables(chainID, HscVersion string) error
- func (db *SQLDB) Close()
- func (db *SQLDB) GetBlock(chainID string, height uint64) (types.EventData, error)
- func (db *SQLDB) Init(chainID, HscVersion string) error
- func (db *SQLDB) InitChain(chainID, HscVersion string) (chainIDChanged bool, _ error)
- func (db *SQLDB) LastBlockHeight(chainID string) (uint64, error)
- func (db *SQLDB) Ping() error
- func (db *SQLDB) RestoreDB(restoreTime time.Time, prefix string) error
- func (db *SQLDB) SetBlock(chainID string, eventTables types.EventTables, eventData types.EventData) error
- func (db *SQLDB) SetBlockHeight(tx sqlx.Ext, chainID string, height uint64) error
- func (db *SQLDB) SynchronizeDB(chainID string, eventTables types.EventTables) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLDB ¶
type SQLDB struct { DB *sqlx.DB adapters.DBAdapter Schema string Queries Queries types.SQLNames Log *logging.Logger }
SQLDB implements the access to a sql database
func NewSQLDB ¶
func NewSQLDB(connection types.SQLConnection) (*SQLDB, error)
NewSQLDB delegates work to a specific database adapter implementation, opens database connection and create log tables
func (*SQLDB) CleanTables ¶
CleanTables drop tables if stored chainID is different from the given one & store new chainID if the chainID is the same, do nothing
func (*SQLDB) Init ¶
Initialise the system and chain tables in case this is the first run - is idempotent though will drop tables if ChainID has changed
func (*SQLDB) RestoreDB ¶
RestoreDB restores the DB to a given moment in time. If prefix is provided restores the table state to a new set of tables as <prefix>_<table name>. Drops destination tables before recreating them. If zero time passed restores all values
func (*SQLDB) SetBlock ¶
func (db *SQLDB) SetBlock(chainID string, eventTables types.EventTables, eventData types.EventData) error
SetBlock inserts or updates multiple rows and stores log info in SQL tables
func (*SQLDB) SetBlockHeight ¶
func (*SQLDB) SynchronizeDB ¶
func (db *SQLDB) SynchronizeDB(chainID string, eventTables types.EventTables) error
SynchronizeDB synchronize db tables structures from given tables specifications