Go接口API

GetObject

func GetObject(key []byte) ([]byte, error)

输入

参数

说明

key

查询的key值

输出

参数

说明

value, nil

key值查询成功,返回value值

_, 非nil

key值不存在

PutObject

func PutObject(key []byte, value []byte) error

输入

参数

说明

key

存入的key值

value

存入key值对应的value值

输出

参数

说明

nil

存入db成功

非nil

存入db失败

DeleteObject

func DeleteObject(key []byte) error

输入

参数

说明

key

将要删除的key值

输出

参数

说明

nil

删除成功

非nil

删除失败

QueryTx

func QueryTx(txid string) (*pb.Transaction, error)

输入

参数

说明

txid

待查询的txid

输出

参数

说明

tx, nil

查询交易成功, 得到此txid的transaction

_, 非nil

查询交易失败

QueryBlock

func QueryBlock(blockid string) (*pb.Block, error)

输入

参数

说明

blockid

待查询的blockid

输出

参数

说明

block, nil

查询block成功, 得到此blockid的block

_, 非nil

查询block失败

NewIterator

func NewIterator(start, limit []byte) Iterator

输入

参数

说明

start

初始关键字

limit

结束关键字

输出

参数

说明

Iterator

Interator的接口

样例

1
2
3
4
5
6
Key() []byte
Value() []byte
Next() bool
Error() error
// Iterator 必须在使用完毕后关闭
Close()