optimize source code layout

pull/196/head
Michael Li 2 years ago
parent 5433eb9e8f
commit 367e0b018b

@ -0,0 +1 @@
### RESTful API for paopao-ce use [go-mir](https://github.com/alimy/mir) to generate service interface code automatic.

@ -0,0 +1,2 @@
### gRPC API
This directory contain some gRPC API define files.

@ -1,23 +1,23 @@
package servants
package core
import (
"github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/model"
)
type baseServant struct {
type BaseServant struct {
// TODO
}
type baseBinding struct {
type BaseBinding struct {
// TODO
}
type baseRender struct {
type BaseRender struct {
// TODO
}
func (baseServant) userFrom(c *gin.Context) (*model.User, bool) {
func (BaseServant) userFrom(c *gin.Context) (*model.User, bool) {
if u, exists := c.Get("USER"); exists {
user, ok := u.(*model.User)
return user, ok

@ -2,11 +2,11 @@ package servants
import (
"github.com/gin-gonic/gin"
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
"github.com/rocboss/paopao-ce/internal/servants/web"
)
// RegisterServants register all the servants to gin.Engine
func RegisterServants(e *gin.Engine) {
api.RegisterWebCoreServant(e, newWebCoreSrv(), newWebCoreBinding(), newWebCoreRender())
api.RegisterWebCoreServant(e, web.NewWebCoreSrv(), web.NewWebCoreBinding(), web.NewWebCoreRender())
}

@ -1,4 +1,4 @@
package servants
package web
type webAdminSrv struct {
// TODO

@ -1,4 +1,4 @@
package servants
package web
type webAlipaySrv struct {
// TODO

@ -1,32 +1,27 @@
package servants
package web
import (
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
"github.com/rocboss/paopao-ce/internal/servants/core"
)
var (
_ api.WebCore = (*webCoreSrv)(nil)
_ api.WebCoreBinding = (*webCoreBinding)(nil)
_ api.WebCoreRender = (*webCoreRender)(nil)
)
type webCoreSrv struct {
baseServant
core.BaseServant
api.UnimplementedWebCoreServant
}
type webCoreBinding struct {
baseBinding
core.BaseBinding
api.UnimplementedWebCoreBinding
}
type webCoreRender struct {
baseRender
core.BaseRender
api.UnimplementedWebCoreRender
}
func newWebCoreSrv() api.WebCore {
return &webCoreSrv{}
}
func newWebCoreBinding() api.WebCoreBinding {
return &webCoreBinding{}
}
func newWebCoreRender() api.WebCoreRender {
return &webCoreRender{}
}

@ -1,4 +1,4 @@
package servants
package web
type webFollowshipSrv struct {
// TODO

@ -1,4 +1,4 @@
package servants
package web
type webFriendshipSrv struct {
// TODO

@ -1,4 +1,4 @@
package servants
package web
type webLooseSrv struct {
// TODO

@ -1,4 +1,4 @@
package servants
package web
type webPrivSrv struct {
// TODO

@ -1,4 +1,4 @@
package servants
package web
type webPubSrv struct {
// TODO

@ -0,0 +1,17 @@
package web
import (
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
)
func NewWebCoreSrv() api.WebCore {
return &webCoreSrv{}
}
func NewWebCoreBinding() api.WebCoreBinding {
return &webCoreBinding{}
}
func NewWebCoreRender() api.WebCoreRender {
return &webCoreRender{}
}

@ -0,0 +1,8 @@
package version
var (
// GitHash Value will be set during build
GitHash = ""
// BuildTime Value will be set during build
BuildTime = ""
)
Loading…
Cancel
Save