This section is empty.


This section is empty.


This section is empty.


type Queries

type Queries struct {
	LastBlockHeight *sqlx.NamedStmt
	SetBlockHeight  string

type SQLDB

type SQLDB struct {
	DB *sqlx.DB
	Schema  string
	Queries Queries
	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

      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(chainID string, height uint64) (types.EventData, error)

            GetBlock returns all tables structures and row data for given block

            func (*SQLDB) Init

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

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

              func (db *SQLDB) InitChain(chainID, burrowVersion string) (chainIDChanged bool, _ error)

              func (*SQLDB) LastBlockHeight

              func (db *SQLDB) LastBlockHeight(chainID string) (uint64, error)

              func (*SQLDB) Ping

              func (db *SQLDB) Ping() error

                Ping database

                func (*SQLDB) RestoreDB

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

                  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 (db *SQLDB) SetBlockHeight(tx sqlx.Ext, chainID string, height uint64) error

                    func (*SQLDB) SynchronizeDB

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

                      SynchronizeDB synchronize db tables structures from given tables specifications


                      Path Synopsis