objectbox-dart icon indicating copy to clipboard operation
objectbox-dart copied to clipboard

Add support for protocol buffer generated files

Open tomasweigenast opened this issue 3 years ago • 3 comments

I would like another way to define entities for ObjectBox instead of using annotations. This can be useful if someone is using ProtocolBuffers to generate files. I've considered to use ProtocolBuffers classes as DTOs and create another class to use Object Box.

tomasweigenast avatar May 29 '21 01:05 tomasweigenast

ObjectBox is not a generic key-value store, it internally uses flatbuffers to store entities and access them in a structured way, to be able to execute queries on them. I think it's rather unlikely this will change so in case you're using protobuf, it would need to be converted to flatbuffers at some point anyway. Alternatively you could store the whole protobuf as a single binary field in a simple wrapper object, but that's almost certainly not what you're looking for.

vaind avatar May 29 '21 09:05 vaind

Any update on this? It will be a very helpful if it will be done. Currently, I have to do another mapping with protocol buffer.

sumitsharansatsangi avatar May 03 '22 09:05 sumitsharansatsangi

@sumitsharansatsangi No updates. See the previous comment https://github.com/objectbox/objectbox-dart/issues/257#issuecomment-850806637 on why it's unlikely we will support this.

If you are asking about how to store a protocol buffer in a property, you can do this using a getter/setter: https://docs.objectbox.io/advanced/custom-types#convert-annotation-and-property-converter

greenrobot-team avatar May 09 '22 08:05 greenrobot-team