本文整理匯總了Golang中github.com/hyperledger/fabric/core/ledger.Ledger.SetStateMultipleKeys方法的典型用法代碼示例。如果您正苦於以下問題:Golang Ledger.SetStateMultipleKeys方法的具體用法?Golang Ledger.SetStateMultipleKeys怎麽用?Golang Ledger.SetStateMultipleKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hyperledger/fabric/core/ledger.Ledger
的用法示例。
在下文中一共展示了Ledger.SetStateMultipleKeys方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"key5": []byte("value5"),
"key6": []byte("value6"),
"key7": []byte("value7"),
"key8": []byte("value8_new"),
}
AssertIteratorContains(itr, expected)
itr.Close()
})
})
Describe("Ledger GetSetMultipleKeys", func() {
ledgerPtr := InitSpec()
It("creates, populates, finishes, commits and validates a batch", func() {
Expect(ledgerPtr.BeginTxBatch(1)).To(BeNil())
ledgerPtr.TxBegin("txUuid1")
ledgerPtr.SetStateMultipleKeys("chaincodeID", map[string][]byte{"key1": []byte("value1"), "key2": []byte("value2")})
ledgerPtr.TxFinished("txUuid1", true)
uuid := util.GenerateUUID()
tx, err := protos.NewTransaction(protos.ChaincodeID{Path: "testUrl"}, uuid, "anyfunction", []string{"param1, param2"})
Expect(err).To(BeNil())
err = ledgerPtr.CommitTxBatch(1, []*protos.Transaction{tx}, nil, []byte("proof"))
Expect(err).To(BeNil())
values, err := ledgerPtr.GetStateMultipleKeys("chaincodeID", []string{"key1", "key2"}, true)
Expect(err).To(BeNil())
Expect(values).To(Equal([][]byte{[]byte("value1"), []byte("value2")}))
})
})
Describe("Ledger CopyState", func() {
ledgerPtr := InitSpec()
It("creates, populates, finishes, commits and validates a batch", func() {