sqldb

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLDB

type SQLDB struct {
	DB        *sql.DB
	DBAdapter adapters.DBAdapter
	Schema    string
	Log       *logger.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

func (db *SQLDB) CleanTables(chainID, burrowVersion string) error

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) Close

func (db *SQLDB) Close()

Close database connection

func (*SQLDB) GetBlock

func (db *SQLDB) GetBlock(height uint64) (types.EventData, error)

GetBlock returns all tables structures and row data for given block

func (*SQLDB) GetLastBlockHeight

func (db *SQLDB) GetLastBlockHeight() (uint64, error)

GetLastBlockID returns last inserted blockId from log table

func (*SQLDB) Ping

func (db *SQLDB) Ping() error

Ping database

func (*SQLDB) RestoreDB

func (db *SQLDB) RestoreDB(time time.Time, prefix string) error

RestoreDB restores the DB to a given moment in time

func (*SQLDB) SetBlock

func (db *SQLDB) SetBlock(eventTables types.EventTables, eventData types.EventData) error

SetBlock inserts or updates multiple rows and stores log info in SQL tables

func (*SQLDB) SynchronizeDB

func (db *SQLDB) SynchronizeDB(eventTables types.EventTables) error

SynchronizeDB synchronize db tables structures from given tables specifications

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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