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

*timestamppb.Timestamp does not implement fastpb.Sizer (missing Size method) #835

Closed
wayne8668 opened this issue Feb 23, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@wayne8668
Copy link

在proto文件中import官方的timestamp类型时,显示如题错误。并且提示undefined: timestamp.File_timestamp_proto

请问关于time.Time类型的最佳实践是怎样的?还是说建议使用string类型?谢谢!

@HeyJavaBean HeyJavaBean self-assigned this Feb 23, 2023
@HeyJavaBean HeyJavaBean added bug Something isn't working and removed bug Something isn't working labels Feb 24, 2023
@HeyJavaBean HeyJavaBean added the bug Something isn't working label Feb 27, 2023
@HeyJavaBean
Copy link
Member

HeyJavaBean commented Feb 28, 2023

这个问题是因为 kitex 依赖的 pb 编解码库 fastpb https://github.com/cloudwego/fastpb 对结构体新增了接口,但没对官方库的 timestamp 这些给出对应的实现导致的。
解决方案:

  1. 不 import 官方的 timestamp,复制官方的 idl,和代码一起生成,这样的 timestamp 结构体就可以用
  2. 不使用 fastpb,生成代码的时候 kitex 命令行多带一个 -no-fast-api 参数,走正常的 pb 逻辑
    这个问题我放到 fastpb 项目下,后续看下有没有更好的兼容方案,这里先 Closed 了。感谢反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants