datamanager

package
v0.0.0-...-48972bb Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Str2Big

func Str2Big(num string) *big.Int

Types

type DBCreator

type DBCreator func(dbname string) database.Database

DBCreator to create db instance

type DataManager

type DataManager struct {
	// contains filtered or unexported fields
}

DataManager data access between app and database

func NewDataManager

func NewDataManager(cfg *config.Config, logger *zap.Logger, dbc DBCreator) (*DataManager, error)

NewDataManager create data manager

func (*DataManager) AddTransaction

func (m *DataManager) AddTransaction(data *define.TransactionData) (uint64, error)

AddTransaction insert a tx record

func (*DataManager) AddTransactionStmt

func (m *DataManager) AddTransactionStmt(stmt *sql.Stmt, data *define.TransactionData) (err error)

func (*DataManager) Close

func (m *DataManager) Close()

Close close all dbs

func (*DataManager) PrepareTransaction

func (m *DataManager) PrepareTransaction() (*sql.Stmt, error)

func (*DataManager) QTxBegin

func (m *DataManager) QTxBegin() error

QTxBegin start database transaction of qdb

func (*DataManager) QTxCommit

func (m *DataManager) QTxCommit() error

QTxCommit commit database transaction of qdb

func (*DataManager) QTxRollback

func (m *DataManager) QTxRollback() error

QTxRollback rollback database transaction of qdb

func (*DataManager) QueryAccountTxs

func (m *DataManager) QueryAccountTxs(accid *ethcmn.Address, direction uint8, cursor, limit uint64, order string) ([]define.TransactionData, error)

QueryAccountTxs query account's tx records

func (*DataManager) QueryAllTxs

func (m *DataManager) QueryAllTxs(cursor, limit uint64, order string) ([]define.TransactionData, error)

QueryAllTxs query all tx records

func (*DataManager) QuerySingleTx

func (m *DataManager) QuerySingleTx(txhash *ethcmn.Hash) (*define.TransactionData, error)

QuerySingleTx query single tx record

func (*DataManager) QueryTxByHash

func (m *DataManager) QueryTxByHash(txhash *ethcmn.Hash) ([]define.TransactionData, error)

Jump to

Keyboard shortcuts

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