Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/tanlang/replace client with api / 用封装好的 api 代替 httpClient #3

Merged

Conversation

LinZexiao
Copy link
Contributor

Proposal Change

  • 自动注册路由
  • 实现自动生成 IServiceStruct 的工具
  • 增加实现 IService 接口的客户端 api

@LinZexiao LinZexiao force-pushed the feat/tanlang/replace-client-with-api branch from 22ec5b5 to 367e323 Compare January 5, 2023 07:49
client/client.go Outdated Show resolved Hide resolved
cmd/cli/cli.go Outdated Show resolved Hide resolved
cmd/cli/msg.go Outdated Show resolved Hide resolved
@@ -21,43 +24,12 @@ func registerRoute(s *service.Service) http.Handler {
})

apiV0Group := router.Group("/api/v0")
Register(apiV0Group, s, service.IServiceStruct{}.Internal)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没之前那么清晰明了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
将路由和接口以及请求参数放到一起, 这样相比直接注册路由更加明了一些?

return err rather than panic when create client
Copy link

@diwufeiwen diwufeiwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在的实现让调用和新增API变简单了,前提是信任所有的封装是ok的.增加了参与者入门的复杂度,封装部分看起来后续基本不需要改,所以个人觉得还好

client/client.go Outdated Show resolved Hide resolved
utils/gen/api-gen.go Outdated Show resolved Hide resolved
Copy link

@diwufeiwen diwufeiwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zl03jsj
Copy link

zl03jsj commented Jan 9, 2023

:lgtm:

client/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@hunjixin hunjixin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LinZexiao LinZexiao merged commit 0438066 into feat/tanlang/add-more-cmd Jan 9, 2023
@LinZexiao LinZexiao deleted the feat/tanlang/replace-client-with-api branch January 9, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants