CRUD operations with the CQL Interpolator
Closed this issue · 1 comments
fedefernandez commented
This ticket depends on #57
We need to define how all these operations will be written with a CQL Interpolator and what features will be supported.
For example:
Select
cql"SELECT name FROM keyspace1.users WHERE id = $myId"
Aspects to consider:
- The interpolator should accept variables, but how are the values decoded. Currently, we have a
ByteBufferCodec
definition, but the instances should be available in the scope - What is the value type returned by the interpolator?
FreeS[F, ResultSet]
for the selects?
fedefernandez commented
Codecs will be inferred through the embed
method. See the RuntimeCQLInterpolator
.
The interpolator returns the tuple (String, List[OutputValue])
, where:
trait ValueSerializer {
def serialize[M[_]](implicit M: MonadError[M, Throwable]): M[ByteBuffer]
}
case class OutputValue(index: Int, serializer: ValueSerializer)
We could add some implicit methods for the tuple for different transformations. For example:
def asResultSet(implicit api: LowLevelAPI): FS[ResultSet]
def as[Unit](implicit api: LowLevelAPI): FS[ResultSet]
def as[Option[User]](implicit api: LowLevelAPI): FS[Option[User]]