Closed msiebert closed 7 years ago
RowParser(RowParser.long("col"))
It's not already a RowParser
because making it implicit generally doesn't make sense. You have to globally (ish) say what column name maps to a Long
so any call to as[Long]
will also demand a single column name. If you want this in your application, I suggest creating it yourself.
That's what I've done locally and I don't want to make an implicit val for reading Long
s. I just think that it makes more sense to do:
implicit val longParser = RowParser.long("column")
than
implicit val longParser = RowParser(RowParser.long("column"))
I don't follow.
I don't want to make an implicit val for reading Longs
And then you make an implicit val for reading longs?
Sorry, I meant that I don't want to make it an implicit val in the RowParser object. I just wanted to put the invocation of RowParser.apply in the RowParser.long function. I just created this issue so that I'd remember to do it and make a pull request later.
So it should look like:
def long(columnLabel: String) = RowParser((row: SqlRow) => row.long(columnLabel))
makes sense. I've created a PR: https://github.com/lucidsoftware/relate/pull/51
example:
RowParser.long
returns(SqlRow) => Long
, which isn't compatible with the new.as[A]
syntax. It should returnRowParser[Long]
instead.