Different approaches for generating proto classes
Let’s examine the various languages for generating proto classes.
C++
protoc -I=
$SRC_DIR
--cpp_out=
$DST_DIR
$SRC_DIR
/sfapi.proto
C
protoc -I=
$SRC_DIR
--csharp_out=
$DST_DIR
$SRC_DIR
/sfapi.proto
GO
go get golang.org/x/sys/unix go get -u github.com/golang/protobuf/protoc-gen-go protoc -I=
$SRC_DIR
--go_out=
$DST_DIR
$SRC_DIR
/sfapi.proto
Java
protoc -I=
$SRC_DIR
--java_out=
$DST_DIR
$SRC_DIR
/sfapi.proto
Python
protoc -I=
$SRC_DIR
--python_out=
$DST_DIR
$SRC_DIR
/sfapi.proto
NodeJS
On the fly class generation with protobuf.js:
const
grpc
=
require
(
'grpc'
)
const
proto
=
grpc
.
load
(
'./proto/sfapi.proto'
).
sfapi
.
v1
And here are some advanced functionalities.
Option declarations
Option declarations may be declared to engage different behaviors when each language generates the code responsible for the interpretation of the .proto
file.
Here you can find between the lines the full list of possible...