Skip to content

Deriving types for QueryResult Records (and the Option of) #34

Open
@tobyweston

Description

@tobyweston

As the query results are Any, how do you suggest deriving types for the values?

For example:

val temperature: Double = record("temperature").asInstanceOf[BigDecimal].toDouble

but that seems nasty. Do you retain the type from the JSON wire format? Any fancy implicit encoders available?

Similarly, how do you advice handling values which may be not there, e.g.

val maybeTemperature: Option[Double] = record("maybeThere") ...

Would be nice, but as it stands I can get NoSuchElementException when I request something that isn't there.

I had a poke around but couldn't find anything obvious.

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions