Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Design of PickleFormat trait #61

Open
@maqdev

Description

@maqdev

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 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:

trait PickleInputFormat {
  def createReader(pickle: PickleType, mirror: Mirror): PReader
}

trait PickleOutputFormat {
  type OutputType
  def createBuilder(): PBuilder
  def createBuilder(out: OutputType): PBuilder
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions