Documentation
¶
Index ¶
- Variables
- func CreateDB(db *sql.DB) (sql.Result, error)
- func Del(db *sql.DB, key string) error
- func ErrIsNotExist(err error) bool
- func GetAddressKey(addr common.Address) []byte
- func GetBlockHashKey(hash common.Hash) []byte
- func GetCanonicalKey(height uint32) []byte
- func GetStorageKey(hash common.Hash) []byte
- func NewAccountData(address common.Address) *types.AccountData
- func Open(driver string, dbHost string) (*sql.DB, error)
- type AccountDao
- type AssetDao
- func (dao *AssetDao) Get(code common.Hash) (*types.Asset, error)
- func (dao *AssetDao) GetPage(addr common.Address, start, limit int) ([]*types.Asset, error)
- func (dao *AssetDao) GetPageWithTotal(addr common.Address, start, limit int) ([]*types.Asset, int, error)
- func (dao *AssetDao) Set(asset *types.Asset) error
- type BlockDao
- func (dao *BlockDao) GetBlock(hash common.Hash) (*types.Block, error)
- func (dao *BlockDao) GetBlockByHeight(height uint32) (*types.Block, error)
- func (dao *BlockDao) GetDB() *sql.DB
- func (dao *BlockDao) IsExist(hash common.Hash) (bool, error)
- func (dao *BlockDao) SetBlock(hash common.Hash, block *types.Block) error
- type CandidateDao
- func (dao *CandidateDao) Del(user common.Address) error
- func (dao *CandidateDao) GetPage(start, limit int) ([]*CandidateItem, error)
- func (dao *CandidateDao) GetPageWithTotal(start, limit int) ([]*CandidateItem, int, error)
- func (dao *CandidateDao) GetTop(size int) ([]*CandidateItem, error)
- func (dao *CandidateDao) Set(item *CandidateItem) error
- type CandidateItem
- type Context
- type ContextDao
- func (dao *ContextDao) ContextGet(key string) ([]byte, error)
- func (dao *ContextDao) ContextLoad() ([]*Context, error)
- func (dao *ContextDao) ContextSet(key string, val []byte) error
- func (dao *ContextDao) GetCurrentBlock() (*types.Block, error)
- func (dao *ContextDao) SetCurrentBlock(block *types.Block) error
- type DBEngine
- type EquityDao
- func (dao *EquityDao) Get(addr common.Address, id common.Hash) (*types.AssetEquity, error)
- func (dao *EquityDao) GetPage(addr common.Address, start, limit int) ([]*types.AssetEquity, error)
- func (dao *EquityDao) GetPageByCode(addr common.Address, code common.Hash, start, limit int) ([]*types.AssetEquity, error)
- func (dao *EquityDao) GetPageByCodeWithTotal(addr common.Address, code common.Hash, start, limit int) ([]*types.AssetEquity, int, error)
- func (dao *EquityDao) GetPageWithTotal(addr common.Address, start, limit int) ([]*types.AssetEquity, int, error)
- func (dao *EquityDao) Set(addr common.Address, assetEquity *types.AssetEquity) error
- type KvDao
- type MetaData
- type MetaDataDao
- func (dao *MetaDataDao) Get(id common.Hash) (*MetaData, error)
- func (dao *MetaDataDao) GetPage(addr common.Address, start, limit int) ([]*MetaData, error)
- func (dao *MetaDataDao) GetPageByCode(code common.Hash, start, limit int) ([]*MetaData, error)
- func (dao *MetaDataDao) GetPageByCodeWithTotal(code common.Hash, start, limit int) ([]*MetaData, int, error)
- func (dao *MetaDataDao) GetPageWithTotal(addr common.Address, start, limit int) ([]*MetaData, int, error)
- func (dao *MetaDataDao) Set(metaData *MetaData) error
- type MySqlDB
- type Tx
- type TxDao
- func (dao *TxDao) Get(hash common.Hash) (*Tx, error)
- func (dao *TxDao) GetByAddr(addr common.Address, start, limit int) ([]*Tx, error)
- func (dao *TxDao) GetByAddrWithTotal(addr common.Address, start, limit int) ([]*Tx, int, error)
- func (dao *TxDao) GetByAddressAndAssetCodeOrAssetId(addr common.Address, assetCodeOrId common.Hash, start, limit int) ([]*Tx, error)
- func (dao *TxDao) GetByAddressAndAssetCodeOrAssetIdWithTotal(addr common.Address, assetCodeOrId common.Hash, start, limit int) ([]*Tx, int, error)
- func (dao *TxDao) GetByFrom(addr common.Address, start, limit int) ([]*Tx, error)
- func (dao *TxDao) GetByFromWithTotal(addr common.Address, start, limit int) ([]*Tx, int, error)
- func (dao *TxDao) GetByTime(addr common.Address, stStart, stStop int64, start, limit int) ([]*Tx, error)
- func (dao *TxDao) GetByTimeWithTotal(addr common.Address, stStart, stStop int64, start, limit int) ([]*Tx, int, error)
- func (dao *TxDao) GetByTo(addr common.Address, start, limit int) ([]*Tx, error)
- func (dao *TxDao) GetByToWithTotal(addr common.Address, start, limit int) ([]*Tx, int, error)
- func (dao *TxDao) Set(tx *Tx) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrArgInvalid = errors.New("invalid argument") ErrExist = errors.New("item already exists") ErrNoEvents = errors.New("the times of pop event is more than push") ErrNotExist = errors.New("item does not exist") ErrBigIntSetString = errors.New("big int setString error") ErrOutOfMemory = errors.New("out of memory") ErrUnKnown = errors.New("") )
View Source
var ( DRIVER_MYSQL = "mysql" HOST_MYSQL = "root:123456@tcp(localhost:3306)/lemochain?charset=utf8mb4" )
View Source
var (
ContextKeyCurrentBlock = "context.chain.current_block"
)
Functions ¶
func ErrIsNotExist ¶
func GetAddressKey ¶
func GetBlockHashKey ¶
func GetCanonicalKey ¶
func GetStorageKey ¶ added in v1.2.0
func NewAccountData ¶
func NewAccountData(address common.Address) *types.AccountData
Types ¶
type AccountDao ¶
type AccountDao struct {
// contains filtered or unexported fields
}
func NewAccountDao ¶
func NewAccountDao(db DBEngine) *AccountDao
func (*AccountDao) Get ¶
func (dao *AccountDao) Get(addr common.Address) (*types.AccountData, error)
func (*AccountDao) GetDB ¶
func (dao *AccountDao) GetDB() *sql.DB
func (*AccountDao) Set ¶
func (dao *AccountDao) Set(addr common.Address, account *types.AccountData) error
type AssetDao ¶
type AssetDao struct {
// contains filtered or unexported fields
}
func NewAssetDao ¶
func (*AssetDao) GetPageWithTotal ¶
type BlockDao ¶
type BlockDao struct {
// contains filtered or unexported fields
}
func NewBlockDao ¶
func (*BlockDao) GetBlockByHeight ¶
type CandidateDao ¶
type CandidateDao struct {
// contains filtered or unexported fields
}
func NewCandidateDao ¶
func NewCandidateDao(engine DBEngine) *CandidateDao
func (*CandidateDao) GetPage ¶
func (dao *CandidateDao) GetPage(start, limit int) ([]*CandidateItem, error)
func (*CandidateDao) GetPageWithTotal ¶
func (dao *CandidateDao) GetPageWithTotal(start, limit int) ([]*CandidateItem, int, error)
func (*CandidateDao) GetTop ¶
func (dao *CandidateDao) GetTop(size int) ([]*CandidateItem, error)
func (*CandidateDao) Set ¶
func (dao *CandidateDao) Set(item *CandidateItem) error
type ContextDao ¶
type ContextDao struct {
// contains filtered or unexported fields
}
func NewContextDao ¶
func NewContextDao(db DBEngine) *ContextDao
func (*ContextDao) ContextGet ¶
func (dao *ContextDao) ContextGet(key string) ([]byte, error)
func (*ContextDao) ContextLoad ¶
func (dao *ContextDao) ContextLoad() ([]*Context, error)
func (*ContextDao) ContextSet ¶
func (dao *ContextDao) ContextSet(key string, val []byte) error
func (*ContextDao) GetCurrentBlock ¶
func (dao *ContextDao) GetCurrentBlock() (*types.Block, error)
func (*ContextDao) SetCurrentBlock ¶
func (dao *ContextDao) SetCurrentBlock(block *types.Block) error
type EquityDao ¶
type EquityDao struct {
// contains filtered or unexported fields
}
func NewEquityDao ¶
func (*EquityDao) GetPageByCode ¶
func (*EquityDao) GetPageByCodeWithTotal ¶
func (*EquityDao) GetPageWithTotal ¶
type KvDao ¶
type KvDao struct {
// contains filtered or unexported fields
}
*
- (1) hash => block
- (2) hash => tx
- (3) address => account
type MetaData ¶ added in v1.2.0
type MetaData struct {
Id common.Hash `json:"id" gencodec:"required"`
Code common.Hash `json:"code" gencodec:"required"`
Owner common.Address `json:"owner" gencodec:"required"`
Profile string `json:"profile" gencodec:"required"`
}
func (MetaData) MarshalJSON ¶ added in v1.2.0
MarshalJSON marshals as JSON.
func (*MetaData) UnmarshalJSON ¶ added in v1.2.0
UnmarshalJSON unmarshals from JSON.
type MetaDataDao ¶ added in v1.2.0
type MetaDataDao struct {
// contains filtered or unexported fields
}
func NewMetaDataDao ¶ added in v1.2.0
func NewMetaDataDao(db DBEngine) *MetaDataDao
func (*MetaDataDao) Get ¶ added in v1.2.0
func (dao *MetaDataDao) Get(id common.Hash) (*MetaData, error)
func (*MetaDataDao) GetPageByCode ¶ added in v1.2.0
func (*MetaDataDao) GetPageByCodeWithTotal ¶ added in v1.2.0
func (*MetaDataDao) GetPageWithTotal ¶ added in v1.2.0
func (*MetaDataDao) Set ¶ added in v1.2.0
func (dao *MetaDataDao) Set(metaData *MetaData) error
type Tx ¶
type Tx struct {
BHash common.Hash
Height uint32
PHash common.Hash // 为箱子交易的时候的箱子的hash
THash common.Hash
From common.Address
To common.Address
Tx *types.Transaction
Flag int
St int64 // 交易保存进db的时间
PackageTime uint32 // 打包交易的时间
AssetCode common.Hash // 如果是资产交易则对应资产code
AssetId common.Hash // 对应资产交易的资产id
}
type TxDao ¶
type TxDao struct {
// contains filtered or unexported fields
}
func (*TxDao) GetByAddrWithTotal ¶
func (*TxDao) GetByAddressAndAssetCodeOrAssetId ¶ added in v1.2.0
func (dao *TxDao) GetByAddressAndAssetCodeOrAssetId(addr common.Address, assetCodeOrId common.Hash, start, limit int) ([]*Tx, error)
通过 address 和 assetCode或者assetId查询交易
func (*TxDao) GetByAddressAndAssetCodeOrAssetIdWithTotal ¶ added in v1.2.0
func (*TxDao) GetByFromWithTotal ¶
func (*TxDao) GetByTimeWithTotal ¶
func (*TxDao) GetByToWithTotal ¶
Click to show internal directories.
Click to hide internal directories.