github.com/lzy4123/fabric@v2.1.1+incompatible/core/handlers/decoration/decoration.go (about) 1 /* 2 Copyright IBM Corp, SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package decoration 8 9 import ( 10 "github.com/hyperledger/fabric-protos-go/peer" 11 ) 12 13 // Decorator decorates a chaincode input 14 type Decorator interface { 15 // Decorate decorates a chaincode input by changing it 16 Decorate(proposal *peer.Proposal, input *peer.ChaincodeInput) *peer.ChaincodeInput 17 } 18 19 // Apply decorators in the order provided 20 func Apply(proposal *peer.Proposal, input *peer.ChaincodeInput, 21 decorators ...Decorator) *peer.ChaincodeInput { 22 for _, decorator := range decorators { 23 input = decorator.Decorate(proposal, input) 24 } 25 26 return input 27 }