Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.simple</groupId>
<artifactId>jdub_2.11</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<name>Jdub for Scala ${scala.version}</name>
<url>https://github.com/SimpleFinance/jdub</url>
<description>Jdub is a Scala wrapper over JDBC.</description>
Expand Down
17 changes: 14 additions & 3 deletions src/main/scala/com/simple/jdub/Row.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import java.sql.SQLXML
import java.sql.Time
import java.sql.Timestamp
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
import java.util.UUID

Expand Down Expand Up @@ -127,12 +128,12 @@ class Row(rs: ResultSet) {
def bigDecimal(name: String): Option[BigDecimal] = extract(rs.getBigDecimal(name)).map { scala.math.BigDecimal(_) }

/**
* Extract the value at the given offset as an Option[Array[Byte]].
* Extract the value at the given offset as an `Option[Array[Byte]]`.
*/
def bytes(index: Int): Option[Array[Byte]] = extract(rs.getBytes(index + 1))

/**
* Extract the value with the given name as an Option[Array[Byte]].
* Extract the value with the given name as an `Option[Array[Byte]]`.
*/
def bytes(name: String): Option[Array[Byte]] = extract(rs.getBytes(name))

Expand All @@ -154,7 +155,7 @@ class Row(rs: ResultSet) {
/**
* Extract the value with the given name as an Option[Time].
*/
def time(name: String) = extract(rs.getTime(name))
def time(name: String): Option[Time] = extract(rs.getTime(name))

/**
* Extract the value at the given offset as an Option[Timestamp].
Expand Down Expand Up @@ -186,6 +187,16 @@ class Row(rs: ResultSet) {
*/
def localDateTime(name: String): Option[LocalDateTime] = timestamp(name).map(_.toLocalDateTime)

/**
* Extract the value at the given offset as an Option[LocalDate].
*/
def localDate(index: Int): Option[LocalDate] = localDateTime(index).map(_.toLocalDate)

/**
* Extract the value with the given name as an Option[LocalDate].
*/
def localDate(name: String): Option[LocalDate] = localDateTime(name).map(_.toLocalDate)

/**
* Extract the value with the given name as an Option[DateTime].
*/
Expand Down