upgrade github.com/alimy/mir/v3 => v3.0.0-alpha.5

pull/196/head
Michael Li 2 years ago
parent 43c45b4599
commit 4d379e278a
No known key found for this signature in database

@ -6,7 +6,7 @@ require (
github.com/Masterminds/semver/v3 v3.1.1 github.com/Masterminds/semver/v3 v3.1.1
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868
github.com/alimy/cfg v0.1.0 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/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible
github.com/allegro/bigcache/v3 v3.0.2 github.com/allegro/bigcache/v3 v3.0.2
github.com/bytedance/sonic v1.5.0 github.com/bytedance/sonic v1.5.0

@ -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/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 h1:J7KDLEoVIjEBMGlQJb2ljad/d49gJ4Tsl2ogZ9XNhaY=
github.com/alimy/cfg v0.1.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= 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.5 h1:KFv8ulmC1hDPDezh/dQ+ZwZwmmwrcWUV4TZJrMBZB8I=
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/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 h1:9gWa46nstkJ9miBReJcN8Gq34cBFbzSpQZVVT9N09TM=
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= 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= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=

@ -38,21 +38,21 @@ type User interface {
// Chain provide handlers chain for gin // Chain provide handlers chain for gin
Chain() gin.HandlersChain Chain() gin.HandlersChain
Logout(c *gin.Context) mir.Error Logout() mir.Error
Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) Login(*LoginReq) (*LoginResp, mir.Error)
mustEmbedUnimplementedUserServant() mustEmbedUnimplementedUserServant()
} }
type UserBinding interface { type UserBinding interface {
BindLogin(c *gin.Context) (*LoginReq, mir.Error) BindLogin(*gin.Context) (*LoginReq, mir.Error)
mustEmbedUnimplementedUserBinding() mustEmbedUnimplementedUserBinding()
} }
type UserRender interface { type UserRender interface {
RenderLogout(c *gin.Context, err mir.Error) RenderLogout(*gin.Context, mir.Error)
RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) RenderLogin(*gin.Context, *LoginResp, mir.Error)
mustEmbedUnimplementedUserRender() mustEmbedUnimplementedUserRender()
} }
@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) {
// register routes info to router // register routes info to router
router.Handle("POST", "/user/logout/", func(c *gin.Context) { 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) { 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 { if err != nil {
r.RenderLogin(c, nil, err) r.RenderLogin(c, nil, err)
} }
resp, err := s.Login(c, req) resp, err := s.Login(req)
r.RenderLogin(c, resp, err) r.RenderLogin(c, resp, err)
}) })
@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain {
return nil return nil
} }
func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { func (UnimplementedUserServant) Logout() mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) 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)) return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
} }

@ -38,21 +38,21 @@ type User interface {
// Chain provide handlers chain for gin // Chain provide handlers chain for gin
Chain() gin.HandlersChain Chain() gin.HandlersChain
Logout(c *gin.Context) mir.Error Logout() mir.Error
Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) Login(*LoginReq) (*LoginResp, mir.Error)
mustEmbedUnimplementedUserServant() mustEmbedUnimplementedUserServant()
} }
type UserBinding interface { type UserBinding interface {
BindLogin(c *gin.Context) (*LoginReq, mir.Error) BindLogin(*gin.Context) (*LoginReq, mir.Error)
mustEmbedUnimplementedUserBinding() mustEmbedUnimplementedUserBinding()
} }
type UserRender interface { type UserRender interface {
RenderLogout(c *gin.Context, err mir.Error) RenderLogout(*gin.Context, mir.Error)
RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) RenderLogin(*gin.Context, *LoginResp, mir.Error)
mustEmbedUnimplementedUserRender() mustEmbedUnimplementedUserRender()
} }
@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) {
// register routes info to router // register routes info to router
router.Handle("POST", "/user/logout/", func(c *gin.Context) { 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) { 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 { if err != nil {
r.RenderLogin(c, nil, err) r.RenderLogin(c, nil, err)
} }
resp, err := s.Login(c, req) resp, err := s.Login(req)
r.RenderLogin(c, resp, err) r.RenderLogin(c, resp, err)
}) })
@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain {
return nil return nil
} }
func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { func (UnimplementedUserServant) Logout() mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) 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)) return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
} }

@ -35,23 +35,23 @@ type UserInfo struct {
} }
type User interface { type User interface {
Logout(c *gin.Context) mir.Error Logout() mir.Error
Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) Login(*LoginReq) (*LoginResp, mir.Error)
Index(c *gin.Context) mir.Error Index() mir.Error
mustEmbedUnimplementedUserServant() mustEmbedUnimplementedUserServant()
} }
type UserBinding interface { type UserBinding interface {
BindLogin(c *gin.Context) (*LoginReq, mir.Error) BindLogin(*gin.Context) (*LoginReq, mir.Error)
mustEmbedUnimplementedUserBinding() mustEmbedUnimplementedUserBinding()
} }
type UserRender interface { type UserRender interface {
RenderLogout(c *gin.Context, err mir.Error) RenderLogout(*gin.Context, mir.Error)
RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) RenderLogin(*gin.Context, *LoginResp, mir.Error)
RenderIndex(c *gin.Context, err mir.Error) RenderIndex(*gin.Context, mir.Error)
mustEmbedUnimplementedUserRender() mustEmbedUnimplementedUserRender()
} }
@ -62,7 +62,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) {
// register routes info to router // register routes info to router
router.Handle("POST", "/user/logout/", func(c *gin.Context) { 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) { 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 { if err != nil {
r.RenderLogin(c, nil, err) r.RenderLogin(c, nil, err)
} }
resp, err := s.Login(c, req) resp, err := s.Login(req)
r.RenderLogin(c, resp, err) r.RenderLogin(c, resp, err)
}) })
router.Handle("GET", "/index/", func(c *gin.Context) { 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 { 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)) 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)) 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)) return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
} }

@ -38,25 +38,25 @@ type WebCore interface {
// Chain provide handlers chain for gin // Chain provide handlers chain for gin
Chain() gin.HandlersChain Chain() gin.HandlersChain
Logout(c *gin.Context) mir.Error Logout() mir.Error
Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) Login(*LoginReq) (*LoginResp, mir.Error)
Articles(c *gin.Context) mir.Error Articles() mir.Error
Index(c *gin.Context) mir.Error Index() mir.Error
mustEmbedUnimplementedWebCoreServant() mustEmbedUnimplementedWebCoreServant()
} }
type WebCoreBinding interface { type WebCoreBinding interface {
BindLogin(c *gin.Context) (*LoginReq, mir.Error) BindLogin(*gin.Context) (*LoginReq, mir.Error)
mustEmbedUnimplementedWebCoreBinding() mustEmbedUnimplementedWebCoreBinding()
} }
type WebCoreRender interface { type WebCoreRender interface {
RenderLogout(c *gin.Context, err mir.Error) RenderLogout(*gin.Context, mir.Error)
RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) RenderLogin(*gin.Context, *LoginResp, mir.Error)
RenderArticles(c *gin.Context, err mir.Error) RenderArticles(*gin.Context, mir.Error)
RenderIndex(c *gin.Context, err mir.Error) RenderIndex(*gin.Context, mir.Error)
mustEmbedUnimplementedWebCoreRender() mustEmbedUnimplementedWebCoreRender()
} }
@ -70,7 +70,7 @@ func RegisterWebCoreServant(e *gin.Engine, s WebCore, b WebCoreBinding, r WebCor
// register routes info to router // register routes info to router
router.Handle("POST", "/user/logout/", func(c *gin.Context) { 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) { 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 { if err != nil {
r.RenderLogin(c, nil, err) r.RenderLogin(c, nil, err)
} }
resp, err := s.Login(c, req) resp, err := s.Login(req)
r.RenderLogin(c, resp, err) r.RenderLogin(c, resp, err)
}) })
{ {
h := func(c *gin.Context) { h := func(c *gin.Context) {
r.RenderArticles(c, s.Articles(c)) r.RenderArticles(c, s.Articles())
} }
router.Handle("HEAD", "/articles/:category/", h) router.Handle("HEAD", "/articles/:category/", h)
router.Handle("GET", "/articles/:category/", h) router.Handle("GET", "/articles/:category/", h)
} }
router.Handle("GET", "/index/", func(c *gin.Context) { 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 return nil
} }
func (UnimplementedWebCoreServant) Logout(c *gin.Context) mir.Error { func (UnimplementedWebCoreServant) Logout() mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) 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)) 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)) 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)) return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
} }

@ -38,21 +38,21 @@ type User interface {
// Chain provide handlers chain for gin // Chain provide handlers chain for gin
Chain() gin.HandlersChain Chain() gin.HandlersChain
Logout(c *gin.Context) mir.Error Logout() mir.Error
Login(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error) Login(*LoginReq) (*LoginResp, mir.Error)
mustEmbedUnimplementedUserServant() mustEmbedUnimplementedUserServant()
} }
type UserBinding interface { type UserBinding interface {
BindLogin(c *gin.Context) (*LoginReq, mir.Error) BindLogin(*gin.Context) (*LoginReq, mir.Error)
mustEmbedUnimplementedUserBinding() mustEmbedUnimplementedUserBinding()
} }
type UserRender interface { type UserRender interface {
RenderLogout(c *gin.Context, err mir.Error) RenderLogout(*gin.Context, mir.Error)
RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) RenderLogin(*gin.Context, *LoginResp, mir.Error)
mustEmbedUnimplementedUserRender() mustEmbedUnimplementedUserRender()
} }
@ -66,7 +66,7 @@ func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) {
// register routes info to router // register routes info to router
router.Handle("POST", "/user/logout/", func(c *gin.Context) { 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) { 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 { if err != nil {
r.RenderLogin(c, nil, err) r.RenderLogin(c, nil, err)
} }
resp, err := s.Login(c, req) resp, err := s.Login(req)
r.RenderLogin(c, resp, err) r.RenderLogin(c, resp, err)
}) })
@ -88,11 +88,11 @@ func (UnimplementedUserServant) Chain() gin.HandlersChain {
return nil return nil
} }
func (UnimplementedUserServant) Logout(c *gin.Context) mir.Error { func (UnimplementedUserServant) Logout() mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) 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)) return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
} }

Loading…
Cancel
Save