Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persisting Protobuf messages to Database

What is the right way to persist data defined using protobuf3. I am using golang and Java, both place with support of ORMs. In java with Hibernate and golang with gorm. Both place i need to convert the Generated code to corresponding Entity model. I feel that is more pain full to maintain same object structure in order to be understandable by ORM. Is there any Database which i can use along with protobuf objects as is. Or i can define the relations between objects in the protobuf itself.

Any helps really appreciated.

like image 625
Ysak Avatar asked Aug 13 '17 09:08

Ysak


1 Answers

There is a not-straightforward solution to this problem.

Protobuf 3 standardises JSON mapping for the messages. Once you serialise your message to JSON, you have multiple options for storing it in a database.

The following (and many more) databases can store JSON data:

  • MariaDB
  • PostgreSQL
  • MongoDB
like image 53
Grzegorz Żur Avatar answered Oct 20 '22 10:10

Grzegorz Żur