pqrs
is a tool which deserializes compiled protobuf messages given a set of pre-compiled .fdset
files.
pqrs is on crates.io: cargo install pq
. You can also download a static binary from the releases page.
Read the manpage!
To set up, put your *.fdset
files in ~/.pq
:
$ protoc -o dog.fdset dog.proto
$ protoc -o person.fdset person.proto
$ cp *.fdset ~/.pq/
Pipe a single compiled protobuf message:
$ testbench.py "single()" | pq | jq
{
"age": 4,
"breed": "poodle",
"temperament": "excited"
}
Pipe a varint
-delimited stream:
$ testbench.py "stream(limit=2)" | pq --stream="varint" | jq
{
"age": 10,
"breed": "gsd",
"temperament": "aggressive"
}
{
"id": 3,
"name": "khosrov"
}
Pipe a varint
-delimited stream with trailing newlines:
$ testbench.py "trail(trail=b'\n',limit=2)" | pq --stream=varint --trail=1 | jq
{
"age": 16,
"breed": "gsd",
"temperament": "chill"
}
{
"id": 3,
"name": "raffi"
}