Created
May 20, 2018 15:04
-
-
Save vitiko/e8bed460f7784445c8ade4001e83faf7 to your computer and use it in GitHub Desktop.
Chaincode "constructor"
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
func New() *Chaincode { | |
r := router.New(`cars`) // also initialized logger with "cars" prefix | |
r.Group(`car`). | |
Query(`List`, cars). // chain code method name is carList | |
Query(`Get`, car, p.String(`id`)). // chain code method name is carGet, method has 1 string argument "id" | |
Invoke(`Register`, carRegister, p.Struct(`car`, &CarPayload{}), // 1 struct argument | |
owner.Only) // allow access to method only for chaincode owner (authority) | |
return &Chaincode{r} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment