github.com/lzy4123/fabric@v2.1.1+incompatible/discovery/protoext/response.go (about)

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