1 Star 1 Fork 2

kristas / booting-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
feign_controller.go 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
kristas 提交于 2021-10-22 22:58 . feat: add annotation
package api
import (
"context"
"gitee.com/kristas/booting-go/framework"
"gitee.com/kristas/booting-go/framework/core/statement/types"
"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(FeignController))
}
type FeignController struct {
types.Controller `group:"/feign"`
feign.Factory `wire:"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 *FeignController) TestGetAllUsers() ([]*dto.AccountDTO, error) {
return h.GetTestClient().FindAllUsers()
}
func (h *FeignController) GetUserById(ctx context.Context, username string) (*dto.AccountDTO, error) {
return h.GetTestClient().GetUserById(ctx, username)
}
func (h *FeignController) SaveUser(ctx context.Context, username string, employee *dto.AccountDTO) (resp.Response, error) {
return h.GetTestClient().SaveUser(ctx, username, employee)
}
Go
1
https://gitee.com/kristas/booting-go.git
git@gitee.com:kristas/booting-go.git
kristas
booting-go
booting-go
v1.4.4

搜索帮助