-
-
Save vitiko/e577a203e3e5d8d24fbfd9c24236240f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code generated by protoc-gen-cc-gateway. DO NOT EDIT. | |
// source: service.proto | |
import ( | |
cckit_ccservice "github.com/s7techlab/cckit/gateway/service" | |
cckit_gateway "github.com/s7techlab/cckit/gateway" | |
) | |
// gateway implementation | |
// gateway can be used as kind of SDK, GRPC or REST server ( via grpc-gateway or clay ) | |
type CPaperGateway struct { | |
Gateway cckit_gateway.Chaincode | |
} | |
// NewCPaperGateway creates gateway to access chaincode method via chaincode service | |
func NewCPaperGateway(ccService cckit_ccservice.Chaincode, channel, chaincode string, opts ...cckit_gateway.Opt) *CPaperGateway { | |
return &CPaperGateway{Gateway: cckit_gateway.NewChaincode(ccService, channel, chaincode, opts...)} | |
} | |
type ValidatorInterface interface { | |
Validate() error | |
} | |
func (c *CPaperGateway) Issue(ctx context.Context, in *schema.IssueCommercialPaper) (*schema.CommercialPaper, error) { | |
var inMsg interface{} = in | |
if v, ok := inMsg.(ValidatorInterface); ok { | |
if err := v.Validate(); err != nil { | |
return nil, err | |
} | |
} | |
if res, err := c.Gateway.Invoke(ctx, CPaperChaincode_Issue, []interface{}{in}, &schema.CommercialPaper{}); err != nil { | |
return nil, err | |
} else { | |
return res.(*schema.CommercialPaper), nil | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment