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

基础类型如何复用? #16

Closed
flazx opened this issue Jan 13, 2020 · 1 comment
Closed

基础类型如何复用? #16

flazx opened this issue Jan 13, 2020 · 1 comment

Comments

@flazx
Copy link

flazx commented Jan 13, 2020

上次我提了一个dao层复用的问题,今天又遇到一个基础类型的protoc如何复用的问题:
shopAdmin protoc:
message goods{...}
shopFront protoc:
message goods{...}
这两个protoc都有goods这个基础的类型,如何做才能比较优美的实现复用?

@taoso
Copy link
Member

taoso commented Jan 13, 2020

一般来说,proto 这一层是不鼓励复用的。这些 message 看起来挺像,但不同的接口对字段的要求是不一样的。即便开始的时候一样,后台也可能出现分化。所以我们这边都是不复用的。

如果真想复用,可以搞一个 rpc/common/xxx.proto,把公共的写义写在这里,再利用 proto 的 import 语法导入。

@flazx flazx closed this as completed Feb 29, 2020
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

No branches or pull requests

2 participants