完成基础路由注册, 遗留 : form表单, any数据类型解析失败

This commit is contained in:
2024-07-21 18:49:44 +08:00
parent 455f74ad89
commit f8f63691b7
3 changed files with 86 additions and 17 deletions

View File

@ -27,17 +27,19 @@ func (t *TestController) RouterMiddleware() []gin.HandlerFunc {
}
}
func (t *TestController) Uri(ctx *gin.Context, formData *TestForm) (any, error) {
return nil, nil
return formData, nil
}
type TestForm struct {
Meta `tag:"测试表单" path:"/a/b/c/d" desc:"测试接口" method:"get" strict:"true"`
Age int `json:"age" form:"age"`
Name string `json:"name" form:"name"`
Test any `json:"test" form:"test"`
}
func Test_parseController(t *testing.T) {
type args struct {
controller any
}
parseController(TestController{})
parseController(&TestController{})
Register(8080, &TestController{})
}