From d20cf56a69fbd842690985367e2997793487c1c9 Mon Sep 17 00:00:00 2001 From: Phibe <87901608+phibe2017@users.noreply.github.com> Date: Tue, 10 Aug 2021 18:02:11 +0800 Subject: [PATCH] simplify type definition in readme (#896) * better text rendering * simplify type definition in readme --- readme.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index c68a6280..1ef98a0f 100644 --- a/readme.md +++ b/readme.md @@ -112,13 +112,15 @@ go get -u github.com/tal-tech/go-zero 2. create the API file, like greet.api, you can install the plugin of goctl in vs code, api syntax is supported. ```go - type Request struct { - Name string `path:"name,options=you|me"` // parameters are auto validated - } + type ( + Request { + Name string `path:"name,options=you|me"` // parameters are auto validated + } - type Response struct { - Message string `json:"message"` - } + Response { + Message string `json:"message"` + } + ) service greet-api { @handler GreetHandler @@ -217,4 +219,4 @@ Join the chat via https://join.slack.com/t/go-zero/shared_invite/zt-thyennhc-_fN ## Give a Star! ⭐ -If you like or are using this project to learn or start your solution, please give it a star. Thanks! \ No newline at end of file +If you like or are using this project to learn or start your solution, please give it a star. Thanks!