upgrade github.com/alimy/mir/v4 => v4.0.0-alpha.4

pull/327/head
Michael Li 1 year ago
parent c89e781b51
commit dd66cc3627
No known key found for this signature in database

@ -85,31 +85,13 @@ func RegisterUserServant(e *gin.Engine, s User) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(LoginReq) req := new(LoginReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.Login(req) resp, err := s.Login(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -85,31 +85,13 @@ func RegisterUserServant(e *gin.Engine, s User) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(LoginReq) req := new(LoginReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.Login(req) resp, err := s.Login(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -80,31 +80,13 @@ func RegisterUserServant(e *gin.Engine, s User) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(LoginReq) req := new(LoginReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.Login(req) resp, err := s.Login(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/index/", func(c *gin.Context) { router.Handle("GET", "/index/", func(c *gin.Context) {
select { select {

@ -12,6 +12,19 @@ import (
"github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/model/web"
) )
type _binding_ interface {
Bind(*gin.Context) mir.Error
}
type _render_ interface {
Render(*gin.Context)
}
type _default_ interface {
Bind(*gin.Context, any) mir.Error
Render(*gin.Context, any, mir.Error)
}
type Admin interface { type Admin interface {
_default_ _default_
@ -38,22 +51,11 @@ func RegisterAdminServant(e *gin.Engine, s Admin) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ChangeUserStatusReq) req := new(web.ChangeUserStatusReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ChangeUserStatus(req)) s.Render(c, nil, s.ChangeUserStatus(req))
}) })
} }

@ -40,31 +40,14 @@ func RegisterAlipayPrivServant(e *gin.Engine, s AlipayPriv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UserWalletBillsReq) req := new(web.UserWalletBillsReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.UserWalletBills(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.UserWalletBills(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/recharge", func(c *gin.Context) { router.Handle("GET", "/user/recharge", func(c *gin.Context) {
select { select {
@ -73,31 +56,14 @@ func RegisterAlipayPrivServant(e *gin.Engine, s AlipayPriv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UserRechargeResultReq) req := new(web.UserRechargeResultReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.UserRechargeResult(req) resp, err := s.UserRechargeResult(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/user/recharge", func(c *gin.Context) { router.Handle("POST", "/user/recharge", func(c *gin.Context) {
select { select {
@ -106,31 +72,14 @@ func RegisterAlipayPrivServant(e *gin.Engine, s AlipayPriv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UserRechargeLinkReq) req := new(web.UserRechargeLinkReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.UserRechargeLink(req) resp, err := s.UserRechargeLink(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -32,22 +32,12 @@ func RegisterAlipayPubServant(e *gin.Engine, s AlipayPub) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.AlipayNotifyReq) req := new(web.AlipayNotifyReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.AlipayNotify(req)) s.Render(c, nil, s.AlipayNotify(req))
}) })
} }

@ -53,31 +53,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetCollectionStatusReq) req := new(web.TweetCollectionStatusReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.TweetCollectionStatus(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.TweetCollectionStatus(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/post/star", func(c *gin.Context) { router.Handle("GET", "/post/star", func(c *gin.Context) {
select { select {
@ -86,31 +69,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetStarStatusReq) req := new(web.TweetStarStatusReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.TweetStarStatus(req) resp, err := s.TweetStarStatus(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/suggest/tags", func(c *gin.Context) { router.Handle("GET", "/suggest/tags", func(c *gin.Context) {
select { select {
@ -119,31 +85,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.SuggestTagsReq) req := new(web.SuggestTagsReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.SuggestTags(req) resp, err := s.SuggestTags(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/suggest/users", func(c *gin.Context) { router.Handle("GET", "/suggest/users", func(c *gin.Context) {
select { select {
@ -152,31 +101,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.SuggestUsersReq) req := new(web.SuggestUsersReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.SuggestUsers(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.SuggestUsers(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/user/avatar", func(c *gin.Context) { router.Handle("POST", "/user/avatar", func(c *gin.Context) {
select { select {
@ -185,22 +117,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ChangeAvatarReq) req := new(web.ChangeAvatarReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ChangeAvatar(req)) s.Render(c, nil, s.ChangeAvatar(req))
}) })
router.Handle("POST", "/user/nickname", func(c *gin.Context) { router.Handle("POST", "/user/nickname", func(c *gin.Context) {
@ -210,22 +131,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ChangeNicknameReq) req := new(web.ChangeNicknameReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ChangeNickname(req)) s.Render(c, nil, s.ChangeNickname(req))
}) })
router.Handle("POST", "/user/password", func(c *gin.Context) { router.Handle("POST", "/user/password", func(c *gin.Context) {
@ -235,22 +145,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ChangePasswordReq) req := new(web.ChangePasswordReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ChangePassword(req)) s.Render(c, nil, s.ChangePassword(req))
}) })
router.Handle("POST", "/user/phone", func(c *gin.Context) { router.Handle("POST", "/user/phone", func(c *gin.Context) {
@ -260,22 +159,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UserPhoneBindReq) req := new(web.UserPhoneBindReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.UserPhoneBind(req)) s.Render(c, nil, s.UserPhoneBind(req))
}) })
router.Handle("GET", "/user/stars", func(c *gin.Context) { router.Handle("GET", "/user/stars", func(c *gin.Context) {
@ -285,31 +173,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetStarsReq) req := new(web.GetStarsReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.GetStars(req) resp, err := s.GetStars(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/collections", func(c *gin.Context) { router.Handle("GET", "/user/collections", func(c *gin.Context) {
select { select {
@ -318,31 +189,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetCollectionsReq) req := new(web.GetCollectionsReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.GetCollections(req) resp, err := s.GetCollections(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/user/whisper", func(c *gin.Context) { router.Handle("POST", "/user/whisper", func(c *gin.Context) {
select { select {
@ -351,22 +205,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.SendWhisperReq) req := new(web.SendWhisperReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.SendUserWhisper(req)) s.Render(c, nil, s.SendUserWhisper(req))
}) })
router.Handle("POST", "/user/message/read", func(c *gin.Context) { router.Handle("POST", "/user/message/read", func(c *gin.Context) {
@ -376,22 +219,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ReadMessageReq) req := new(web.ReadMessageReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ReadMessage(req)) s.Render(c, nil, s.ReadMessage(req))
}) })
router.Handle("GET", "/user/messages", func(c *gin.Context) { router.Handle("GET", "/user/messages", func(c *gin.Context) {
@ -401,31 +233,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetMessagesReq) req := new(web.GetMessagesReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.GetMessages(req) resp, err := s.GetMessages(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/msgcount/unread", func(c *gin.Context) { router.Handle("GET", "/user/msgcount/unread", func(c *gin.Context) {
select { select {
@ -434,31 +249,13 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetUnreadMsgCountReq) req := new(web.GetUnreadMsgCountReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.GetUnreadMsgCount(req) resp, err := s.GetUnreadMsgCount(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/info", func(c *gin.Context) { router.Handle("GET", "/user/info", func(c *gin.Context) {
select { select {
@ -467,31 +264,14 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UserInfoReq) req := new(web.UserInfoReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.GetUserInfo(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.GetUserInfo(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/sync/index", func(c *gin.Context) { router.Handle("GET", "/sync/index", func(c *gin.Context) {
select { select {
@ -500,22 +280,11 @@ func RegisterCoreServant(e *gin.Engine, s Core) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.SyncSearchIndexReq) req := new(web.SyncSearchIndexReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.SyncSearchIndex(req)) s.Render(c, nil, s.SyncSearchIndex(req))
}) })
} }

@ -41,31 +41,13 @@ func RegisterFollowshipServant(e *gin.Engine, s Followship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ListFollowersReq) req := new(web.ListFollowersReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.ListFollowers(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.ListFollowers(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/following/list", func(c *gin.Context) { router.Handle("GET", "/following/list", func(c *gin.Context) {
select { select {
@ -74,31 +56,13 @@ func RegisterFollowshipServant(e *gin.Engine, s Followship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.ListFollowingsReq) req := new(web.ListFollowingsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.ListFollowings(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.ListFollowings(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/following/delete", func(c *gin.Context) { router.Handle("POST", "/following/delete", func(c *gin.Context) {
select { select {
@ -107,22 +71,11 @@ func RegisterFollowshipServant(e *gin.Engine, s Followship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DeleteFollowingReq) req := new(web.DeleteFollowingReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.DeleteFollowing(req)) s.Render(c, nil, s.DeleteFollowing(req))
}) })
router.Handle("POST", "/following/add", func(c *gin.Context) { router.Handle("POST", "/following/add", func(c *gin.Context) {
@ -132,22 +85,11 @@ func RegisterFollowshipServant(e *gin.Engine, s Followship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.AddFollowingReq) req := new(web.AddFollowingReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.AddFollowing(req)) s.Render(c, nil, s.AddFollowing(req))
}) })
} }

@ -42,31 +42,13 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetContactsReq) req := new(web.GetContactsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.GetContacts(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.GetContacts(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/friend/delete", func(c *gin.Context) { router.Handle("POST", "/friend/delete", func(c *gin.Context) {
select { select {
@ -75,22 +57,11 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DeleteFriendReq) req := new(web.DeleteFriendReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.DeleteFriend(req)) s.Render(c, nil, s.DeleteFriend(req))
}) })
router.Handle("POST", "/friend/reject", func(c *gin.Context) { router.Handle("POST", "/friend/reject", func(c *gin.Context) {
@ -100,22 +71,11 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.RejectFriendReq) req := new(web.RejectFriendReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.RejectFriend(req)) s.Render(c, nil, s.RejectFriend(req))
}) })
router.Handle("POST", "/friend/add", func(c *gin.Context) { router.Handle("POST", "/friend/add", func(c *gin.Context) {
@ -125,22 +85,11 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.AddFriendReq) req := new(web.AddFriendReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.AddFriend(req)) s.Render(c, nil, s.AddFriend(req))
}) })
router.Handle("POST", "/friend/requesting", func(c *gin.Context) { router.Handle("POST", "/friend/requesting", func(c *gin.Context) {
@ -150,22 +99,11 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.RequestingFriendReq) req := new(web.RequestingFriendReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.RequestingFriend(req)) s.Render(c, nil, s.RequestingFriend(req))
}) })
} }

@ -42,31 +42,13 @@ func RegisterLooseServant(e *gin.Engine, s Loose) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetCommentsReq) req := new(web.TweetCommentsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.TweetComments(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.TweetComments(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/tags", func(c *gin.Context) { router.Handle("GET", "/tags", func(c *gin.Context) {
select { select {
@ -75,31 +57,13 @@ func RegisterLooseServant(e *gin.Engine, s Loose) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TopicListReq) req := new(web.TopicListReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.TopicList(req) resp, err := s.TopicList(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/profile", func(c *gin.Context) { router.Handle("GET", "/user/profile", func(c *gin.Context) {
select { select {
@ -108,31 +72,13 @@ func RegisterLooseServant(e *gin.Engine, s Loose) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetUserProfileReq) req := new(web.GetUserProfileReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.GetUserProfile(req) resp, err := s.GetUserProfile(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/user/posts", func(c *gin.Context) { router.Handle("GET", "/user/posts", func(c *gin.Context) {
select { select {
@ -141,31 +87,13 @@ func RegisterLooseServant(e *gin.Engine, s Loose) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.GetUserTweetsReq) req := new(web.GetUserTweetsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.GetUserTweets(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.GetUserTweets(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/posts", func(c *gin.Context) { router.Handle("GET", "/posts", func(c *gin.Context) {
select { select {
@ -174,31 +102,14 @@ func RegisterLooseServant(e *gin.Engine, s Loose) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TimelineReq) req := new(web.TimelineReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.Timeline(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.Timeline(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
} }

@ -58,22 +58,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UnfollowTopicReq) req := new(web.UnfollowTopicReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.UnfollowTopic(req)) s.Render(c, nil, s.UnfollowTopic(req))
}) })
router.Handle("POST", "/topic/follow", func(c *gin.Context) { router.Handle("POST", "/topic/follow", func(c *gin.Context) {
@ -83,22 +72,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.FollowTopicReq) req := new(web.FollowTopicReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.FollowTopic(req)) s.Render(c, nil, s.FollowTopic(req))
}) })
router.Handle("POST", "/topic/stick", func(c *gin.Context) { router.Handle("POST", "/topic/stick", func(c *gin.Context) {
@ -108,31 +86,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.StickTopicReq) req := new(web.StickTopicReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.StickTopic(req) resp, err := s.StickTopic(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/tweet/reply/thumbsdown", func(c *gin.Context) { router.Handle("POST", "/tweet/reply/thumbsdown", func(c *gin.Context) {
select { select {
@ -141,22 +101,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetReplyThumbsReq) req := new(web.TweetReplyThumbsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ThumbsDownTweetReply(req)) s.Render(c, nil, s.ThumbsDownTweetReply(req))
}) })
router.Handle("POST", "/tweet/reply/thumbsup", func(c *gin.Context) { router.Handle("POST", "/tweet/reply/thumbsup", func(c *gin.Context) {
@ -166,22 +115,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetReplyThumbsReq) req := new(web.TweetReplyThumbsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ThumbsUpTweetReply(req)) s.Render(c, nil, s.ThumbsUpTweetReply(req))
}) })
router.Handle("POST", "/tweet/comment/thumbsdown", func(c *gin.Context) { router.Handle("POST", "/tweet/comment/thumbsdown", func(c *gin.Context) {
@ -191,22 +129,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetCommentThumbsReq) req := new(web.TweetCommentThumbsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ThumbsDownTweetComment(req)) s.Render(c, nil, s.ThumbsDownTweetComment(req))
}) })
router.Handle("POST", "/tweet/comment/thumbsup", func(c *gin.Context) { router.Handle("POST", "/tweet/comment/thumbsup", func(c *gin.Context) {
@ -216,22 +143,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetCommentThumbsReq) req := new(web.TweetCommentThumbsReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.ThumbsUpTweetComment(req)) s.Render(c, nil, s.ThumbsUpTweetComment(req))
}) })
router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) { router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) {
@ -241,22 +157,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DeleteCommentReplyReq) req := new(web.DeleteCommentReplyReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.DeleteCommentReply(req)) s.Render(c, nil, s.DeleteCommentReply(req))
}) })
router.Handle("POST", "/post/comment/reply", func(c *gin.Context) { router.Handle("POST", "/post/comment/reply", func(c *gin.Context) {
@ -266,31 +171,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.CreateCommentReplyReq) req := new(web.CreateCommentReplyReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.CreateCommentReply(req) resp, err := s.CreateCommentReply(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("DELETE", "/post/comment", func(c *gin.Context) { router.Handle("DELETE", "/post/comment", func(c *gin.Context) {
select { select {
@ -299,22 +187,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DeleteCommentReq) req := new(web.DeleteCommentReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.DeleteComment(req)) s.Render(c, nil, s.DeleteComment(req))
}) })
router.Handle("POST", "/post/comment", func(c *gin.Context) { router.Handle("POST", "/post/comment", func(c *gin.Context) {
@ -324,31 +201,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.CreateCommentReq) req := new(web.CreateCommentReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.CreateComment(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.CreateComment(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/post/visibility", func(c *gin.Context) { router.Handle("POST", "/post/visibility", func(c *gin.Context) {
select { select {
@ -357,31 +217,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.VisibleTweetReq) req := new(web.VisibleTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.VisibleTweet(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.VisibleTweet(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/post/stick", func(c *gin.Context) { router.Handle("POST", "/post/stick", func(c *gin.Context) {
select { select {
@ -390,31 +232,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.StickTweetReq) req := new(web.StickTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.StickTweet(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.StickTweet(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/post/lock", func(c *gin.Context) { router.Handle("POST", "/post/lock", func(c *gin.Context) {
select { select {
@ -423,31 +247,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.LockTweetReq) req := new(web.LockTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.LockTweet(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.LockTweet(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/post/collection", func(c *gin.Context) { router.Handle("POST", "/post/collection", func(c *gin.Context) {
select { select {
@ -456,31 +262,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.CollectionTweetReq) req := new(web.CollectionTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.CollectionTweet(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.CollectionTweet(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/post/star", func(c *gin.Context) { router.Handle("POST", "/post/star", func(c *gin.Context) {
select { select {
@ -489,31 +277,13 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.StarTweetReq) req := new(web.StarTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.StarTweet(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.StarTweet(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("DELETE", "/post", func(c *gin.Context) { router.Handle("DELETE", "/post", func(c *gin.Context) {
select { select {
@ -522,22 +292,11 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DeleteTweetReq) req := new(web.DeleteTweetReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.DeleteTweet(req)) s.Render(c, nil, s.DeleteTweet(req))
}) })
router.Handle("POST", "/post", func(c *gin.Context) { router.Handle("POST", "/post", func(c *gin.Context) {
@ -547,31 +306,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.CreateTweetReq) req := new(web.CreateTweetReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.CreateTweet(req) resp, err := s.CreateTweet(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/attachment", func(c *gin.Context) { router.Handle("GET", "/attachment", func(c *gin.Context) {
select { select {
@ -580,31 +322,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DownloadAttachmentReq) req := new(web.DownloadAttachmentReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.DownloadAttachment(req) resp, err := s.DownloadAttachment(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/attachment/precheck", func(c *gin.Context) { router.Handle("GET", "/attachment/precheck", func(c *gin.Context) {
select { select {
@ -613,31 +338,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.DownloadAttachmentPrecheckReq) req := new(web.DownloadAttachmentPrecheckReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.DownloadAttachmentPrecheck(req) resp, err := s.DownloadAttachmentPrecheck(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/attachment", func(c *gin.Context) { router.Handle("POST", "/attachment", func(c *gin.Context) {
select { select {
@ -646,31 +354,14 @@ func RegisterPrivServant(e *gin.Engine, s Priv) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.UploadAttachmentReq) req := new(web.UploadAttachmentReq)
obj = req var bv _binding_ = req
if bv, ok := obj.(_binding_); !ok { if err := bv.Bind(c); err != nil {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.UploadAttachment(req) resp, err := s.UploadAttachment(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -12,19 +12,6 @@ import (
"github.com/rocboss/paopao-ce/internal/model/web" "github.com/rocboss/paopao-ce/internal/model/web"
) )
type _binding_ interface {
Bind(*gin.Context) mir.Error
}
type _render_ interface {
Render(*gin.Context)
}
type _default_ interface {
Bind(*gin.Context, any) mir.Error
Render(*gin.Context, any, mir.Error)
}
type Pub interface { type Pub interface {
_default_ _default_
@ -50,31 +37,13 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.TweetDetailReq) req := new(web.TweetDetailReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.TweetDetail(req) resp, err := s.TweetDetail(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/captcha", func(c *gin.Context) { router.Handle("POST", "/captcha", func(c *gin.Context) {
select { select {
@ -83,22 +52,11 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.SendCaptchaReq) req := new(web.SendCaptchaReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
s.Render(c, nil, s.SendCaptcha(req)) s.Render(c, nil, s.SendCaptcha(req))
}) })
router.Handle("GET", "/captcha", func(c *gin.Context) { router.Handle("GET", "/captcha", func(c *gin.Context) {
@ -108,21 +66,8 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var ( resp, err := s.GetCaptcha()
obj any s.Render(c, resp, err)
err mir.Error
)
obj, err = s.GetCaptcha()
if err != nil {
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/auth/register", func(c *gin.Context) { router.Handle("POST", "/auth/register", func(c *gin.Context) {
select { select {
@ -131,31 +76,13 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.RegisterReq) req := new(web.RegisterReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.Register(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.Register(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("POST", "/auth/login", func(c *gin.Context) { router.Handle("POST", "/auth/login", func(c *gin.Context) {
select { select {
@ -164,31 +91,13 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(web.LoginReq) req := new(web.LoginReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err)
return
}
obj, err = s.Login(req)
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
if rv, ok := obj.(_render_); !ok { resp, err := s.Login(req)
s.Render(c, obj, nil) s.Render(c, resp, err)
} else {
rv.Render(c)
}
}) })
router.Handle("GET", "/", func(c *gin.Context) { router.Handle("GET", "/", func(c *gin.Context) {
select { select {
@ -197,21 +106,8 @@ func RegisterPubServant(e *gin.Engine, s Pub) {
default: default:
} }
var ( resp, err := s.Version()
obj any s.Render(c, resp, err)
err mir.Error
)
obj, err = s.Version()
if err != nil {
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -85,31 +85,13 @@ func RegisterUserServant(e *gin.Engine, s User) {
default: default:
} }
var (
obj any
err mir.Error
)
req := new(LoginReq) req := new(LoginReq)
obj = req if err := s.Bind(c, req); err != nil {
if bv, ok := obj.(_binding_); !ok {
err = s.Bind(c, req)
} else {
err = bv.Bind(c)
}
if err != nil {
s.Render(c, nil, err) s.Render(c, nil, err)
return return
} }
obj, err = s.Login(req) resp, err := s.Login(req)
if err != nil { s.Render(c, resp, err)
s.Render(c, nil, err)
return
}
if rv, ok := obj.(_render_); !ok {
s.Render(c, obj, nil)
} else {
rv.Render(c)
}
}) })
} }

@ -6,7 +6,8 @@ require (
github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/semver/v3 v3.2.1
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868
github.com/alimy/cfg v0.3.0 github.com/alimy/cfg v0.3.0
github.com/alimy/mir/v4 v4.0.0-alpha.3 github.com/alimy/mir/engine/gin/v4 v4.0.0
github.com/alimy/mir/v4 v4.0.0-alpha.4
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/allegro/bigcache/v3 v3.0.2 github.com/allegro/bigcache/v3 v3.0.2
github.com/bytedance/sonic v1.9.1 github.com/bytedance/sonic v1.9.1

@ -131,8 +131,10 @@ 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.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY= github.com/alimy/cfg v0.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY=
github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c=
github.com/alimy/mir/v4 v4.0.0-alpha.3 h1:T1i3xolo/cvOxCpUTSvAU2AcgB3ajNm0/jM1EbsqpJM= github.com/alimy/mir/engine/gin/v4 v4.0.0 h1:N3nvpniFLW2z1WxU26gHw1FKx+/G+B/5cllOjOTjsWI=
github.com/alimy/mir/v4 v4.0.0-alpha.3/go.mod h1:X09f2IOQ4NTyJFKJ10S+J7Jk988T5IvvprwTijQZAsg= github.com/alimy/mir/engine/gin/v4 v4.0.0/go.mod h1:M28AJQ5h1CEA+m2s6acuVjGXI8ElLNDA5IKtSdWI48k=
github.com/alimy/mir/v4 v4.0.0-alpha.4 h1:UKYwkvYnGo/5wr5pMwy+n2MW1+K8b4btCfdhTQhQB1A=
github.com/alimy/mir/v4 v4.0.0-alpha.4/go.mod h1:X09f2IOQ4NTyJFKJ10S+J7Jk988T5IvvprwTijQZAsg=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis= github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/allegro/bigcache/v3 v3.0.2 h1:AKZCw+5eAaVyNTBmI2fgyPVJhHkdWder3O9IrprcQfI= github.com/allegro/bigcache/v3 v3.0.2 h1:AKZCw+5eAaVyNTBmI2fgyPVJhHkdWder3O9IrprcQfI=

@ -13,6 +13,7 @@ import (
. "github.com/alimy/mir/v4/core" . "github.com/alimy/mir/v4/core"
. "github.com/alimy/mir/v4/engine" . "github.com/alimy/mir/v4/engine"
_ "github.com/alimy/mir/engine/gin/v4"
_ "github.com/rocboss/paopao-ce/mirc/admin/v1" _ "github.com/rocboss/paopao-ce/mirc/admin/v1"
_ "github.com/rocboss/paopao-ce/mirc/bot/v1" _ "github.com/rocboss/paopao-ce/mirc/bot/v1"
_ "github.com/rocboss/paopao-ce/mirc/localoss/v1" _ "github.com/rocboss/paopao-ce/mirc/localoss/v1"

Loading…
Cancel
Save