Skip to content

Commit

Permalink
Merge pull request #111 from SovietSir/reads-and-binder-for-float
Browse files Browse the repository at this point in the history
Added Reads and Binder type-classes for Float type.
  • Loading branch information
Alexey-Yuferov authored Nov 1, 2024
2 parents 68447fa + 9c9aebc commit 324ce62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ object Reads extends ReadsLowerPriority with ReadsLowestPriority {

implicit val stringReads: Reads[String] = (row: Row, index: Int) => row.getString(index)
implicit val doubleReads: Reads[Double] = (row: Row, index: Int) => row.getDouble(index)
implicit val floatReads: Reads[Float] = (row: Row, index: Int) => row.getFloat(index)
implicit val intReads: Reads[Int] = (row: Row, index: Int) => row.getInt(index)
implicit val longReads: Reads[Long] = (row: Row, index: Int) => row.getLong(index)
implicit val byteBufferReads: Reads[ByteBuffer] = (row: Row, index: Int) => row.getByteBuffer(index)
Expand Down
5 changes: 5 additions & 0 deletions src/main/scala/com/ringcentral/cassandra4io/cql/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ package object cql {
(statement.setDouble(index, value), index + 1)
}

implicit val floatBinder: Binder[Float] = new Binder[Float] {
override def bind(statement: BoundStatement, index: Int, value: Float): (BoundStatement, Int) =
(statement.setFloat(index, value), index + 1)
}

implicit val intBinder: Binder[Int] = new Binder[Int] {
override def bind(statement: BoundStatement, index: Int, value: Int): (BoundStatement, Int) =
(statement.setInt(index, value), index + 1)
Expand Down

0 comments on commit 324ce62

Please sign in to comment.