Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Dec 26, 2023
1 parent 4c83784 commit d7ba454
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/content.zh/docs/tutorials/interface-define.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type User struct {
```
* `func(...)...` 表示接口的方法定义;函数中的参数与返回值有着特殊意义:
* 函数可以有多个参数,也可无参数,无参数时表示将这个接口注册为所有HTTP Method handler;
* 函数参数的类型限定为 `mir.(Get/Put/Post/Delete/Head/Patch/Trace/Connect/Options/Any/Chain)`类型、Go `struct`类型;
* 函数参数的类型限定为 `mir.(Get/Put/Post/Delete/Head/Patch/Trace/Connect/Options/Any/Chain/Context)`类型、Go `struct`类型;
* Go `struct`类型作为函数参数只能放置在最后一个参数位置,表示接口需要这个`struct`类型表示的参数类型的从http request中Binding后的结果对象作为请求参数;
* 函数参数中的非最后一个参数,可以有多个,类型限定为`mir.(Get/Put/Post/Delete/Head/Patch/Trace/Connect/Options/Any)`类型;表示的意思是这个接口将注册为相应的HTTP Method handler,比如`mir.Post`表示将这个接口注册为 HTTP Method`POST` 的handler `router.Handle("POST", "/login/", func(...){...})`; `mir.Any` 表示将这个接口注册为所有HTTP Method handler;
* 函数参数中如果有`Chain`表示这个接口有自定义的HTTP引擎中间件的方法,比如gin引擎的`gin.HandlersChain`,会与接口一起注册,目前仅支持`Gin`/`Chi`/`Echo`/`Hertz`/`Iris`引擎;
Expand Down

0 comments on commit d7ba454

Please sign in to comment.