mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
[FAB-16668] fabcar chaincode modify console output
Signed-off-by: SteveKIM <khktoto@gmail.com> Change-Id: I6f549c9ed6e3142b2476d1cd8674d2a6d453668f
This commit is contained in:
parent
f2939e29c6
commit
670d446139
2 changed files with 8 additions and 9 deletions
|
|
@ -152,18 +152,16 @@ func (s *SmartContract) queryAllCars(APIstub shim.ChaincodeStubInterface) pb.Res
|
|||
return shim.Error(err.Error())
|
||||
}
|
||||
// Add a comma before array members, suppress it for the first array member
|
||||
if bArrayMemberAlreadyWritten == true {
|
||||
if bArrayMemberAlreadyWritten {
|
||||
buffer.WriteString(",")
|
||||
}
|
||||
buffer.WriteString("{\"Key\":")
|
||||
buffer.WriteString("\"")
|
||||
buffer.WriteString(queryResponse.Key)
|
||||
buffer.WriteString("\"")
|
||||
|
||||
buffer.WriteString(", \"Record\":")
|
||||
// Record is a JSON object, so we write as-is
|
||||
buffer.WriteString(string(queryResponse.Value))
|
||||
buffer.WriteString("}")
|
||||
buffer.WriteString(
|
||||
fmt.Sprintf(
|
||||
`{"Key":"%s", "Record":%s}`,
|
||||
queryResponse.Key, queryResponse.Value,
|
||||
),
|
||||
)
|
||||
bArrayMemberAlreadyWritten = true
|
||||
}
|
||||
buffer.WriteString("]")
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ require (
|
|||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
|
||||
golang.org/x/text v0.3.2 // indirect
|
||||
google.golang.org/appengine v1.4.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue