1 Star 2 Fork 3

kristas/booting-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test_feign_controller.go 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
kristas 提交于 2021-10-08 17:57 . feat: buld feign client
package api
import (
"context"
"gitee.com/kristas/booting-go/framework"
"gitee.com/kristas/booting-go/framework/core/bean"
"gitee.com/kristas/booting-go/framework/web/resp"
"gitee.com/kristas/booting-go/framework/web/rest"
"gitee.com/kristas/booting-go/internal/demo/dto"
"gitee.com/kristas/booting-go/internal/demo/feign"
)
func init() {
framework.Component(new(TestFeignController))
}
type TestFeignController struct {
bean.Component
feign.Factory `bean:"feign_factory"`
testGetAllUsers rest.GET `url:"/users"`
getUserById rest.GET `url:"/{username}" param:"[c context,username path]"`
saveUser rest.POST `url:"/{username}/save" param:"[c context,username path,user body]"`
}
func (h *TestFeignController) Controller() string {
return "/test/feign"
}
func (h *TestFeignController) TestGetAllUsers() ([]*dto.AccountDTO, error) {
return h.GetTestClient().FindAllUsers()
}
func (h *TestFeignController) GetUserById(ctx context.Context, username string) (*dto.AccountDTO, error) {
return h.GetTestClient().GetUserById(ctx, username)
}
func (h *TestFeignController) SaveUser(ctx context.Context, username string, employee *dto.AccountDTO) (resp.Response, error) {
return h.GetTestClient().SaveUser(ctx, username, employee)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kristas/booting-go.git
git@gitee.com:kristas/booting-go.git
kristas
booting-go
booting-go
v1.4.1

搜索帮助