我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在go中转换protobufs枚举

I have two protocol buffers, X and Y as defined below:

message X {
   string value1 = 1;

   enum Status {
      STATUS_UNSPECIFIED = 0;
      ACTIVE = 1;
      DELETED = 2;
   }
   Status status = 2;
}

message Y {
   string value2 = 1;

   enum Status {
      STATUS_UNSPECIFIED = 0;
      ACTIVE = 1;
      DELETED = 2;
   }
   Status status = 2;
}

I have an instance of X, say x. How can I assign x.status to a new y.status of type Y easily in Go?

近期文章

  • 重用io.Reader和捕获长度
  • net.ip类型转换为String()| 运行时错误
  • 为什么OS X会杀死在终端中立即执行的进程?
  • 在子模块中找不到go包
  • 带有Go-grom的JSON对mysql的支持
  • Golang:无法与MongoDB连接
  • 一个文件两个不同的输出-Windows Server 2012
  • 无法从Go gin上下文获取表单发布正文
  • 如何将范围设置为terraform schema.schema字段?
  • 将数据从mysql加载到Redis集群时出错
  • 使用GoLang将参数传递给wkhtmltopdf
  • 在高山Linux上使用libicu进行编译
  • 接口切片……如何确保此安全性可同时使用?
  • 使用golang附加到文件,其中文件位于NFS附加卷上
  • Go-swagger的Golang和AngularJS项目结构
  • 如何将前端应用程序正确部署到GCE?
  • 将音频缓冲区从Python脚本传输到Go服务器?
  • Go的Makefile
  • 具有两个外键的中间模型:文件结构?
  • 了解标准go ServeMux中的路线匹配

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华