forked from happycrud/protoc-gen-go-gin
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patharticleserver_test.go
40 lines (32 loc) · 909 Bytes
/
articleserver_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package article
import (
"github.com/gin-gonic/gin"
"github.com/sunmi-OS/gocore/v2/api"
)
func InitServerTest() {
router := gin.Default()
httpSrv := NewBlogServiceHttpServer()
RegisterBlogServiceHTTPServer(router, httpSrv)
}
func NewBlogServiceHttpServer() BlogServiceHTTPServer {
return &blogServiceHttpServer{}
}
type blogServiceHttpServer struct {
// 各种db的定义
}
func (b *blogServiceHttpServer) GetOneArticle(context *api.Context, req *GetArticlesReq) (*GetArticlesReply, error) {
//TODO implement me
panic("implement me")
}
func (b *blogServiceHttpServer) GetArticles(context *api.Context, req *GetArticlesReq) (*GetArticlesReply, error) {
return &GetArticlesReply{
Total: 775755,
}, nil
}
func (b *blogServiceHttpServer) CreateArticle(context *api.Context, a *Article) (*Article, error) {
return &Article{
Title: "6666",
Content: "content",
AuthorId: 1,
}, nil
}