pbconv

command module
v0.0.0-...-c98a1e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 15 Imported by: 0

README

pbconv

Protocol Buffers data-format conversion utility.

This supports:

  • pbconv from-proto : Convert JSON or Protocol Buffers Text-format into binary of Protocol Buffers wire format
  • pbconv to-proto : Convert binary of Protocol Buffers wire format into JSON or Text-format

Installation

$ go install github.com/thara/pbconv@latest

Example

sample proto file

syntax = "proto3";

package dev.thara.book;

message Book {
    int64 isbn = 1;
    string title = 2;
    string author = 3;
    bool published = 4;
}
Generate binary of Protocol Buffers wire format from JSON
$ cat book.json
{
  "isbn": 123,
  "title": "sample",
  "author": "Tom",
  "published": true
}
$ cat book.json | pbconv to-proto --from json --out book.bin Book book.proto
Show contents of Protocol Buffers wire format by Text-format
$ pbconv from-proto --in book.bin --to text Book book.proto
isbn: 123
title: "sample"
author: "Tom"
published: true

Author

Tomochika Hara https://thara.dev

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL