Documentation ¶
Index ¶
- Constants
- Variables
- func CalcParaTitle(title string) string
- func ExecAddress(name string) string
- func Hash160AddressToString(addr pcom.Hash160Address) string
- func HeightIndex(height, index int64) int64
- func SetAddrID(addrDriver string)
- func SetVersion(v int32)
- type Block
- type Convert
- type DBCreator
- type DBSaver
- type ExecConvert
- type IKey
- type Key
- type ListKV
- type NeedWrapDB
- type Op
- type Operator
- type Record
- type SourceAbleRecord
- type TxEnv
- type WrapDB
Constants ¶
View Source
const ( SeqTypeAdd = 1 SeqTypeDel = 2 )
SeqType
View Source
const ( OpAdd = 1 OpDel = 2 OpUpdate = 3 )
DB operator
View Source
const ( DatabaseTypeEs = 1 DatabaseTypeChainJRPC = 2 DatabaseTypeChainGRPC = 3 )
DB Type
View Source
const ( //修改Mapping去掉了Type SeqMapping = `` /* 128-byte string literal not displayed */ LastSeqDB = "last_seq" DefaultType = "_doc" )
convert seq
View Source
const ( NormalAddressID = 0 EthAddressID = 2 )
Variables ¶
View Source
var ( ErrDBNotFound = errors.New("DB Not Found") ErrDBBadParam = errors.New("DB Bad Param") ErrDBInvalidOperation = errors.New("DB invalid operation") )
ErrDBNotFound DB Not Found
View Source
var (
DefaultAddrID int32
)
Functions ¶
func Hash160AddressToString ¶
func Hash160AddressToString(addr pcom.Hash160Address) string
Hash160AddressToString 将Hash160格式的地址转换为string格式
func SetVersion ¶
func SetVersion(v int32)
Types ¶
type Block ¶
type Block struct { Height int64 `json:"height"` Ts int64 `json:"ts"` BlockHash string `json:"block_hash"` Index int64 `json:"index"` Send string `json:"send"` TxHash string `json:"tx_hash"` HeightIndex int64 `json:"height_index"` }
Block info
func NewBlockByTxDetail ¶
func NewBlockByTxDetail(txd *rpctypes.TransactionDetail) *Block
NewBlockByTxDetail New
func NewBlockByTxDetail2 ¶
func NewBlockByTxDetail2(txd *types.TransactionDetail) *Block
NewBlockByTxDetail2 New
func SetupBlock ¶
SetupBlock set into to block
type DBCreator ¶
type DBCreator interface { Exists(name string) (bool, error) Create(name string, table, definition string) (bool, error) Delete(name string) (bool, error) GetVersion() int32 }
DBCreator DBCreator nolint
type ExecConvert ¶
ExecConvert with db part 下阶段再分开, 可以配置不同的存储
type SourceAbleRecord ¶
type SourceAbleRecord interface { Record Source() interface{} }
type TxEnv ¶
type TxEnv struct { Block *types.BlockDetail TxIndex int64 BlockHash string }
TxEnv record block info
type WrapDB ¶
type WrapDB interface { Get(k1, k2, id string) (*json.RawMessage, error) List(k1, k2 string, keyValue []*ListKV) ([]*json.RawMessage, error) Set(k1, k2, id string, r Record) error Search(idx, typ string, query *querypara.Query, decode func(x *json.RawMessage) (interface{}, error)) ([]interface{}, error) }
WrapDB 满足虚拟合约执行时访问数据库的要求. 虚拟合约 由于不在链上执行, 插件需要有一定的业务逻辑, 对业务逻辑的处理需要依赖于现有数据 所以需要插件能访问数据库, 目前的逻辑可以通过 Set/Get 来完成. 如果需要更复杂的方式可以扩展这个接口
Click to show internal directories.
Click to hide internal directories.