type ExampleMiddleware struct{} func NewExampleMiddleware() *ExampleMiddleware { return &ExampleMiddleware{} } func (m *ExampleMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // TODO generate middleware implement function, delete a...
接下来对比一下两种熔断器的熔断效果。 这部分示例代码在:go-zero/example下 分别定义了user-api和user-rpc服务,user-api作为客户端对user-rpc进行请求,user-rpc作为服务端响应客户端请求。 在user-rpc的示例方法中,有20%的几率返回错误。 func (l *UserInfoLogic) UserInfo(in *user.UserInfoRequest) (*user.Us...
{Name:"protoc",Usage:"generate grpc code",UsageText:"example: goctl rpc protoc xx.proto --go_out=./pb --go-grpc_out=./pb --zrpc_out=.",Description:"for details, see https://go-zero.dev/cn/goctl-rpc.html",Action:rpc.ZRPC,Flags:[]cli.Flag{...},} 从goctl.go(基本上goctl...
app.Commands=[]cli.Command{{Name:"test",Usage:"this is a test cmd,for example:test -uid=x -name=y",Action:(&Commands{}).Test,Flags:[]cli.Flag{cli.IntFlag{Name:"uid,ud",Usage:"this is a flag,-uid"},cli.StringFlag{Name:"name,ne",Usage:"this is a flag,-name"},},//以下子...
{Name: "test",Usage: "this is a test cmd,for example:test -uid=x -name=y",Action: (&Commands{}).Test,Flags: []cli.Flag{cli.IntFlag{Name: "uid,ud", Usage: "this is a flag,-uid"},cli.StringFlag{Name: "name,ne", Usage: "this is a flag,-name"},},//以下子命令,根据...
Usage: "this is a test cmd,for example:test -uid=x -name=y", Action: (&Commands{}).Test, Flags: []cli.Flag{ cli.IntFlag{Name: "uid,ud", Usage: "this is a flag,-uid"}, cli.StringFlag{Name: "name,ne", Usage: "this is a flag,-name"}, ...
目前仅支持redis缓存,如果选择带缓存模式,即生成的FindOne(ByXxx)&Delete代码会生成带缓存逻辑的代码,目前仅支持单索引字段(除全文索引外),对于联合索引我们默认认为不需要带缓存,且不属于通用型代码,因此没有放在代码生成行列,如example中user表中的id、name、mobile字段均属于单字段索引。 不带缓存模式 ddl goctl ...
update bookstore example for generation prototype Oct 31, 2020 rest optimized Nov 6, 2020 tools/goctl add more test and support route no request and no response Nov 6, 2020 zrpc move redistest into redis package Nov 3, 2020 .codecov.yml ...
git config --global user.name userName git config --global user.email userEmail 分支1 标签0 贡献代码 同步代码 mingpenDocker Hub 镜像加速器shell9f65c814年前 5 次提交 提交取消 提示:由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件 ...
go-zero 是一个集成了各种工程实践的 web 和 rpc 框架。通过弹性设计保障了大并发服务端的稳定性,经受了充分的实战检验。 go-zero 包含极简的 API 定义和生成工具 goctl,可以根据定义的 api 文件一键生成 Go, iOS, Android, Kotlin, Dart, TypeScript, JavaScript 代码,并可直接运行。