-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.go
30 lines (24 loc) · 1005 Bytes
/
response.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package protoext
import "github.com/hyperledger/fabric-protos-go/discovery"
// ResponseConfigAt returns the ConfigResult at a given index in the Response,
// or an Error if present.
func ResponseConfigAt(m *discovery.Response, i int) (*discovery.ConfigResult, *discovery.Error) {
r := m.Results[i]
return r.GetConfigResult(), r.GetError()
}
// ResponseMembershipAt returns the PeerMembershipResult at a given index in the Response,
// or an Error if present.
func ResponseMembershipAt(m *discovery.Response, i int) (*discovery.PeerMembershipResult, *discovery.Error) {
r := m.Results[i]
return r.GetMembers(), r.GetError()
}
// ResponseEndorsersAt returns the PeerMembershipResult at a given index in the Response,
// or an Error if present.
func ResponseEndorsersAt(m *discovery.Response, i int) (*discovery.ChaincodeQueryResult, *discovery.Error) {
r := m.Results[i]
return r.GetCcQueryRes(), r.GetError()
}