I've created a library using the power off scala.pickling.
While I was working on that library I was struggling with PickleFormat.
The problem is that this is solid type for both pickle/unpickle operations. If you're serializing into database there is different types of objects for reading/writing like Statement class (write parameters) and ResultSet/Row classes for reading.
For example in PickleFormat you have to define method createBuilder without parameters which should create instance of empty output type. This is problematic with the database where you have a session/connection object and the output (Statement) is always bound to connection. My proposal is to define separate traits for input/output types:
This allows you to create pickle method with implicit parameters that accepts Statement/Session of database where it's available. The same applies to PickleOutputFormat.
If you're interested in the library please see it here: https://github.com/InnovaCo/capickling
The library is for the Cassandra and allows binding (which is actualy serialization) to database statement and mapping (deserialization) from database results.
@maqdev I really like your proposal. Would you be interested in trying to put more effort behind it for a 0.11.x release? I'm curious what else would have to be done to make this a reality.
Hi!
I've created a library using the power off scala.pickling.
While I was working on that library I was struggling with
PickleFormat
.The problem is that this is solid type for both pickle/unpickle operations. If you're serializing into database there is different types of objects for reading/writing like Statement class (write parameters) and ResultSet/Row classes for reading. For example in
PickleFormat
you have to define methodcreateBuilder
without parameters which should create instance of empty output type. This is problematic with the database where you have a session/connection object and the output (Statement) is always bound to connection. My proposal is to define separate traits for input/output types:This allows you to create pickle method with implicit parameters that accepts Statement/Session of database where it's available. The same applies to
PickleOutputFormat
.If you're interested in the library please see it here: https://github.com/InnovaCo/capickling The library is for the Cassandra and allows binding (which is actualy serialization) to database statement and mapping (deserialization) from database results.