To create a Scala case class from a Protocol Buffer Compiler generated code, you could use a library such as "ScalaPB". Here are the steps to follow:
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.1")
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.10.1"
syntax = "proto3";
package mypackage;
message MyMessage {
int32 id = 1;
string name = 2;
}
sbt compile
package mypackage
case class MyMessage(
id: Int = 0,
name: String = ""
)
val message = MyMessage(1, "John")
println(message.id) // prints 1
println(message.name) // prints "John"
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-28 11:00:00 +0000
Seen: 13 times
Last updated: Feb 13 '22
In SCSS, what is the method for grouping and reusing a set of classes and styles?
What is the method to distinguish the presence of a json field in an array using presto?
What is Nextflow for genomics in AWS?
What are the differences between TREEFROG, CROW, and the CPPCMS C++ framework?
What does "waiting for handler commit" mean in relation to the slow writes experienced in MySQL 8?
What is the best way to arrange the file structure for both the backend and frontend in MERN?