historysqldb

package
v0.0.0-...-8b03266 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountTxHistoryInfo

type AccountTxHistoryInfo struct {
	AccountId   []byte `gorm:"size:2048;primaryKey"` //primary key size max=3072
	BlockHeight uint64 `gorm:"primaryKey"`
	TxId        string `gorm:"size:128;primaryKey"`
}

func (*AccountTxHistoryInfo) GetCountSql

func (b *AccountTxHistoryInfo) GetCountSql() (string, []interface{})

获得 总行数

func (*AccountTxHistoryInfo) GetCreateTableSql

func (b *AccountTxHistoryInfo) GetCreateTableSql(dbType string) string

获得 建表ddl语句

func (*AccountTxHistoryInfo) GetInsertSql

func (b *AccountTxHistoryInfo) GetInsertSql(dbType string) (string, []interface{})

获得insert sql

func (*AccountTxHistoryInfo) GetSaveSql

func (b *AccountTxHistoryInfo) GetSaveSql(_ string) (string, []interface{})

获得 replace into sql

func (*AccountTxHistoryInfo) GetTableName

func (b *AccountTxHistoryInfo) GetTableName() string

获得表名

func (*AccountTxHistoryInfo) GetUpdateSql

func (b *AccountTxHistoryInfo) GetUpdateSql() (string, []interface{})

获得 update sql

type ContractTxHistoryInfo

type ContractTxHistoryInfo struct {
	ContractName string `gorm:"size:128;primaryKey"`
	BlockHeight  uint64 `gorm:"primaryKey"`
	TxId         string `gorm:"size:128;primaryKey"`
	AccountId    []byte `gorm:"size:2048"`
}

func (*ContractTxHistoryInfo) GetCountSql

func (b *ContractTxHistoryInfo) GetCountSql() (string, []interface{})

获得 count语句

func (*ContractTxHistoryInfo) GetCreateTableSql

func (b *ContractTxHistoryInfo) GetCreateTableSql(dbType string) string

获得建表ddl语句

func (*ContractTxHistoryInfo) GetInsertSql

func (b *ContractTxHistoryInfo) GetInsertSql(dbType string) (string, []interface{})

获得 insert 语句

func (*ContractTxHistoryInfo) GetSaveSql

func (b *ContractTxHistoryInfo) GetSaveSql(_ string) (string, []interface{})

返回 replace into 语句

func (*ContractTxHistoryInfo) GetTableName

func (b *ContractTxHistoryInfo) GetTableName() string

获得 表名

func (*ContractTxHistoryInfo) GetUpdateSql

func (b *ContractTxHistoryInfo) GetUpdateSql() (string, []interface{})

获得更新sql语句

type HistorySqlDB

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

HistorySqlDB provider a implementation of `history.HistoryDB` This implementation provides a mysql based data model

func NewHistorySqlDB

func NewHistorySqlDB(dbName string, config *conf.HistoryDbConfig, db protocol.SqlDBHandle,
	logger protocol.Logger) *HistorySqlDB

NewHistorySqlDB construct a new `HistoryDB` for given chainId

func (*HistorySqlDB) Close

func (h *HistorySqlDB) Close()

func (*HistorySqlDB) CommitBlock

func (h *HistorySqlDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error

func (*HistorySqlDB) GetAccountTxHistory

func (h *HistorySqlDB) GetAccountTxHistory(account []byte) (historydb.HistoryIterator, error)

func (*HistorySqlDB) GetContractTxHistory

func (h *HistorySqlDB) GetContractTxHistory(contractName string) (historydb.HistoryIterator, error)

func (*HistorySqlDB) GetHistoryForKey

func (h *HistorySqlDB) GetHistoryForKey(contractName string, key []byte) (historydb.HistoryIterator, error)

func (*HistorySqlDB) GetLastSavepoint

func (s *HistorySqlDB) GetLastSavepoint() (uint64, error)

func (*HistorySqlDB) InitGenesis

func (h *HistorySqlDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error

type StateHistoryInfo

type StateHistoryInfo struct {
	ContractName string `gorm:"size:128;primaryKey"`
	StateKey     []byte `gorm:"size:128;primaryKey"`
	TxId         string `gorm:"size:128;primaryKey"`
	BlockHeight  uint64 `gorm:"primaryKey"`
}

StateHistoryInfo defines mysql orm model, used to create mysql table 'state_history_infos'

func NewStateHistoryInfo

func NewStateHistoryInfo(contractName, txid string, stateKey []byte, blockHeight uint64) *StateHistoryInfo

NewStateHistoryInfo construct a new HistoryInfo

func (*StateHistoryInfo) GetCountSql

func (b *StateHistoryInfo) GetCountSql() (string, []interface{})

返回 总行数

func (*StateHistoryInfo) GetCreateTableSql

func (b *StateHistoryInfo) GetCreateTableSql(dbType string) string

构造返回建表sql语句

func (*StateHistoryInfo) GetInsertSql

func (b *StateHistoryInfo) GetInsertSql(_ string) (string, []interface{})

返回insert sql

func (*StateHistoryInfo) GetSaveSql

func (b *StateHistoryInfo) GetSaveSql(_ string) (string, []interface{})

返回 replace into 语句

func (*StateHistoryInfo) GetTableName

func (b *StateHistoryInfo) GetTableName() string

返回表名字

func (*StateHistoryInfo) GetUpdateSql

func (b *StateHistoryInfo) GetUpdateSql() (string, []interface{})

返回 update sql

Jump to

Keyboard shortcuts

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