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 to pq:
$ ./py-test/testbench.py single | pq | jq
{
"age": 4,
"breed": "poodle",
"temperament": "excited"
}
$ ./py-test/testbench.py single | pq | jq
{
"id": 2,
"name": "raffi"
}
Pipe a dirty (extra leading/trailing chars) to pq:
$ ./py-test/testbench.py dirty | pq | jq
{
"id": 1,
"name": "vahaken"
}
Pipe a varint32
-delimited stream to pq:
$ ./py-test/testbench.py stream | pq --stream | jq
{
"age": 10,
"breed": "gsd",
"temperament": "aggressive"
}
{
"id": 3,
"name": "khosrov"
}
{
"age": 8,
"breed": "rottweiler",
"temperament": "aggressive"
}
{
"id": 2,
"name": "vahaken"
}