liangzimo
V2EX  ›  编程

[protobuf] 请教一下如下格式的 proto 数据定义文件怎么写

  •  
  •   liangzimo · Oct 8, 2022 · 1456 views
    This topic created in 1313 days ago, the information mentioned may be changed or developed.
    1 {
      1 {
        6: 0x726f
      }
      2: "t-16651"
    }
    1 {
      1: "now"
      2: "1665198354978"
    }
    2:"zuo"
    
    message Msg{
        ??? = 1;
        string name = 2;
    }
    

    最外层第一个字段是列表吧,里层数据的 1 号字段数据类型该怎么定义呢? 试过 oneof 不行,字段编号会不一样; any 也不行,会带上数据类型

    1 replies    2022-10-10 10:04:18 +08:00
    S1ngleton
        1
    S1ngleton  
       Oct 10, 2022 via iPhone
    楼主有没有考虑定义成 map 类型,不知道可以满足需求不
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1211 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:37 · PVG 07:37 · LAX 16:37 · JFK 19:37
    ♥ Do have faith in what you're doing.