Skip to content

Commit

Permalink
[FAB-16528] marbles private chaincode sync up
Browse files Browse the repository at this point in the history
This CR is part 2 of porting changes in marbles
private in fabric/integration by FAB-15894 back
to fabric-samples

Signed-off-by: Dongming <dongming@ibm.com>
Change-Id: Ic823bdf4c3c571f43b4700452c50fd4283d35262
  • Loading branch information
Dongming committed Sep 11, 2019
1 parent 3fad853 commit c13a5ec
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions chaincode/marbles02_private/go/marbles_chaincode_private.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,18 +523,16 @@ func (t *SimpleChaincode) getMarblesByRange(stub shim.ChaincodeStubInterface, ar
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("]")
Expand Down

0 comments on commit c13a5ec

Please sign in to comment.