是否可以在grpc中将proto3的默认模型从CamelCase更改为snake_case?
例子 :
文件anyproto.proto

...
message Request {
  bool RequestStatus = 1;
  string RequestMessage = 2
}
...
现在,protoc -I. --go_out=plugins=grpc:. anyproto.proto命令生成此模型:
文件:anyproto.pb.go
type Request struct {
    state         protoimpl.MessageState
    sizeCache     protoimpl.SizeCache
    unknownFields protoimpl.UnknownFields

    RequestStatus  bool    `protobuf:"varint,1,opt,name=requestStatus,proto3" json:"requestStatus,omitempty"`
    RequestMessage string  `protobuf:"bytes,2,opt,name=requestMessage,proto3" json:"requestMessage,omitempty"`
}
我想将requestStatusrequestMessage的样式更改为request_statusrequest_message

最佳答案

这是你想要的?
https://developers.google.com/protocol-buffers/docs/style#message_and_field_names
引用自链接:

message SongServerRequest {
  required string song_name = 1;
}

08-07 03:26