diff --git a/go.mod b/go.mod index 3ab5270f..e826578e 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Masterminds/semver/v3 v3.1.1 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/alimy/cfg v0.1.0 - github.com/alimy/mir/v3 v3.0.0-alpha.4 + github.com/alimy/mir/v3 v3.0.0-alpha.5 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible github.com/allegro/bigcache/v3 v3.0.2 github.com/bytedance/sonic v1.5.0 diff --git a/go.sum b/go.sum index eed23c9b..df94f30e 100644 --- a/go.sum +++ b/go.sum @@ -144,8 +144,8 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/alimy/cfg v0.1.0 h1:J7KDLEoVIjEBMGlQJb2ljad/d49gJ4Tsl2ogZ9XNhaY= github.com/alimy/cfg v0.1.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= -github.com/alimy/mir/v3 v3.0.0-alpha.4 h1:tSmyyhgutMHjgx9TO9891ZCY4qbr3g8FGar4z+9Hhq4= -github.com/alimy/mir/v3 v3.0.0-alpha.4/go.mod h1:ybhT2ijOiDn0lLwWzIY6vXdv+uzZrctS7VFfczcXBWU= +github.com/alimy/mir/v3 v3.0.0-alpha.5 h1:KFv8ulmC1hDPDezh/dQ+ZwZwmmwrcWUV4TZJrMBZB8I= +github.com/alimy/mir/v3 v3.0.0-alpha.5/go.mod h1:ybhT2ijOiDn0lLwWzIY6vXdv+uzZrctS7VFfczcXBWU= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible h1:9gWa46nstkJ9miBReJcN8Gq34cBFbzSpQZVVT9N09TM= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= diff --git a/internal/mirc/auto/api/m/v1/user.go b/internal/mirc/auto/api/m/v1/user.go index c087ae87..b31984b9 100644 --- a/internal/mirc/auto/api/m/v1/user.go +++ b/internal/mirc/auto/api/m/v1/user.go @@ -38,21 +38,21 @@ type User interface { // Chain provide handlers chain for gin Chain() gin.HandlersChain - Logout(c *gin.Context) mir.Error - Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) mustEmbedUnimplementedUserServant() } type UserBinding interface { - BindLogin(c *gin.Context) (*LoginReq, mir.Error) + BindLogin(*gin.Context) (*LoginReq, mir.Error) mustEmbedUnimplementedUserBinding() } type UserRender interface { - RenderLogout(c *gin.Context, err mir.Error) - RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) mustEmbedUnimplementedUserRender() } @@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { // register routes info to router router.Handle("POST", "/user/logout/", func(c *gin.Context) { - r.RenderLogout(c, s.Logout(c)) + r.RenderLogout(c, s.Logout()) }) router.Handle("POST", "/user/login/", func(c *gin.Context) { @@ -74,7 +74,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { if err != nil { r.RenderLogin(c, nil, err) } - resp, err := s.Login(c, req) + resp, err := s.Login(req) r.RenderLogin(c, resp, err) }) @@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain { return nil } -func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { +func (UnimplementedUserServant) Logout() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedUserServant) Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) { +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } diff --git a/internal/mirc/auto/api/r/v1/user.go b/internal/mirc/auto/api/r/v1/user.go index ae9dd9cd..55961d75 100644 --- a/internal/mirc/auto/api/r/v1/user.go +++ b/internal/mirc/auto/api/r/v1/user.go @@ -38,21 +38,21 @@ type User interface { // Chain provide handlers chain for gin Chain() gin.HandlersChain - Logout(c *gin.Context) mir.Error - Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) mustEmbedUnimplementedUserServant() } type UserBinding interface { - BindLogin(c *gin.Context) (*LoginReq, mir.Error) + BindLogin(*gin.Context) (*LoginReq, mir.Error) mustEmbedUnimplementedUserBinding() } type UserRender interface { - RenderLogout(c *gin.Context, err mir.Error) - RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) mustEmbedUnimplementedUserRender() } @@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { // register routes info to router router.Handle("POST", "/user/logout/", func(c *gin.Context) { - r.RenderLogout(c, s.Logout(c)) + r.RenderLogout(c, s.Logout()) }) router.Handle("POST", "/user/login/", func(c *gin.Context) { @@ -74,7 +74,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { if err != nil { r.RenderLogin(c, nil, err) } - resp, err := s.Login(c, req) + resp, err := s.Login(req) r.RenderLogin(c, resp, err) }) @@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain { return nil } -func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { +func (UnimplementedUserServant) Logout() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedUserServant) Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) { +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } diff --git a/internal/mirc/auto/api/s/v1/user.go b/internal/mirc/auto/api/s/v1/user.go index 4751a141..a14c1e42 100644 --- a/internal/mirc/auto/api/s/v1/user.go +++ b/internal/mirc/auto/api/s/v1/user.go @@ -35,23 +35,23 @@ type UserInfo struct { } type User interface { - Logout(c *gin.Context) mir.Error - Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) - Index(c *gin.Context) mir.Error + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + Index() mir.Error mustEmbedUnimplementedUserServant() } type UserBinding interface { - BindLogin(c *gin.Context) (*LoginReq, mir.Error) + BindLogin(*gin.Context) (*LoginReq, mir.Error) mustEmbedUnimplementedUserBinding() } type UserRender interface { - RenderLogout(c *gin.Context, err mir.Error) - RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) - RenderIndex(c *gin.Context, err mir.Error) + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + RenderIndex(*gin.Context, mir.Error) mustEmbedUnimplementedUserRender() } @@ -62,7 +62,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { // register routes info to router router.Handle("POST", "/user/logout/", func(c *gin.Context) { - r.RenderLogout(c, s.Logout(c)) + r.RenderLogout(c, s.Logout()) }) router.Handle("POST", "/user/login/", func(c *gin.Context) { @@ -70,12 +70,12 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { if err != nil { r.RenderLogin(c, nil, err) } - resp, err := s.Login(c, req) + resp, err := s.Login(req) r.RenderLogin(c, resp, err) }) router.Handle("GET", "/index/", func(c *gin.Context) { - r.RenderIndex(c, s.Index(c)) + r.RenderIndex(c, s.Index()) }) } @@ -84,15 +84,15 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { type UnimplementedUserServant struct { } -func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { +func (UnimplementedUserServant) Logout() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedUserServant) Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) { +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedUserServant) Index(c *gin.Context) mir.Error { +func (UnimplementedUserServant) Index() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } diff --git a/internal/mirc/auto/api/v1/web_core.go b/internal/mirc/auto/api/v1/web_core.go index 3e7d3d65..4f797538 100644 --- a/internal/mirc/auto/api/v1/web_core.go +++ b/internal/mirc/auto/api/v1/web_core.go @@ -38,25 +38,25 @@ type WebCore interface { // Chain provide handlers chain for gin Chain() gin.HandlersChain - Logout(c *gin.Context) mir.Error - Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) - Articles(c *gin.Context) mir.Error - Index(c *gin.Context) mir.Error + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + Articles() mir.Error + Index() mir.Error mustEmbedUnimplementedWebCoreServant() } type WebCoreBinding interface { - BindLogin(c *gin.Context) (*LoginReq, mir.Error) + BindLogin(*gin.Context) (*LoginReq, mir.Error) mustEmbedUnimplementedWebCoreBinding() } type WebCoreRender interface { - RenderLogout(c *gin.Context, err mir.Error) - RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) - RenderArticles(c *gin.Context, err mir.Error) - RenderIndex(c *gin.Context, err mir.Error) + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + RenderArticles(*gin.Context, mir.Error) + RenderIndex(*gin.Context, mir.Error) mustEmbedUnimplementedWebCoreRender() } @@ -70,7 +70,7 @@ func RegisterWebCoreServant(e *gin.Engine, s WebCore, b WebCoreBinding, r WebCor // register routes info to router router.Handle("POST", "/user/logout/", func(c *gin.Context) { - r.RenderLogout(c, s.Logout(c)) + r.RenderLogout(c, s.Logout()) }) router.Handle("POST", "/user/login/", func(c *gin.Context) { @@ -78,20 +78,20 @@ func RegisterWebCoreServant(e *gin.Engine, s WebCore, b WebCoreBinding, r WebCor if err != nil { r.RenderLogin(c, nil, err) } - resp, err := s.Login(c, req) + resp, err := s.Login(req) r.RenderLogin(c, resp, err) }) { h := func(c *gin.Context) { - r.RenderArticles(c, s.Articles(c)) + r.RenderArticles(c, s.Articles()) } router.Handle("HEAD", "/articles/:category/", h) router.Handle("GET", "/articles/:category/", h) } router.Handle("GET", "/index/", func(c *gin.Context) { - r.RenderIndex(c, s.Index(c)) + r.RenderIndex(c, s.Index()) }) } @@ -104,19 +104,19 @@ func (UnimplementedWebCoreServant) Chain() gin.HandlersChain { return nil } -func (UnimplementedWebCoreServant) Logout(c *gin.Context) mir.Error { +func (UnimplementedWebCoreServant) Logout() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedWebCoreServant) Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) { +func (UnimplementedWebCoreServant) Login(req *LoginReq) (*LoginResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedWebCoreServant) Articles(c *gin.Context) mir.Error { +func (UnimplementedWebCoreServant) Articles() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedWebCoreServant) Index(c *gin.Context) mir.Error { +func (UnimplementedWebCoreServant) Index() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } diff --git a/internal/mirc/auto/api/x/v1/user.go b/internal/mirc/auto/api/x/v1/user.go index 66446d03..8b579f67 100644 --- a/internal/mirc/auto/api/x/v1/user.go +++ b/internal/mirc/auto/api/x/v1/user.go @@ -38,21 +38,21 @@ type User interface { // Chain provide handlers chain for gin Chain() gin.HandlersChain - Logout(c *gin.Context) mir.Error - Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) mustEmbedUnimplementedUserServant() } type UserBinding interface { - BindLogin(c *gin.Context) (*LoginReq, mir.Error) + BindLogin(*gin.Context) (*LoginReq, mir.Error) mustEmbedUnimplementedUserBinding() } type UserRender interface { - RenderLogout(c *gin.Context, err mir.Error) - RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) mustEmbedUnimplementedUserRender() } @@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { // register routes info to router router.Handle("POST", "/user/logout/", func(c *gin.Context) { - r.RenderLogout(c, s.Logout(c)) + r.RenderLogout(c, s.Logout()) }) router.Handle("POST", "/user/login/", func(c *gin.Context) { @@ -74,7 +74,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { if err != nil { r.RenderLogin(c, nil, err) } - resp, err := s.Login(c, req) + resp, err := s.Login(req) r.RenderLogin(c, resp, err) }) @@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain { return nil } -func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { +func (UnimplementedUserServant) Logout() mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } -func (UnimplementedUserServant) Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) { +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) }