Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
trait ResponseReader[Q <: Query, R <: Response, C[X] <: TraversableOnce[X]] {
def read(response: String): C[R]
}
object ResponseReader {
implicit object SelectResponseReader extends ResponseReader[SelectQuery, SelectResponse, Option] {
def read(json: String): Option[SelectResponse] = ObjMapper.readValue[List[SelectResponse]](json).headOption
}
implicit object TimeSeriesResponseReader extends ResponseReader[TimeSeriesQuery, TimeSeriesResponse, Option] {
def read(json: String): Option[TimeSeriesResponse] = ObjMapper.readValue[List[TimeSeriesResponse]](json).headOption
}
implicit object GroupByResponseReader extends ResponseReader[GroupByQuery, GroupByResponse, IndexedSeq] {
def read(json: String): IndexedSeq[GroupByResponse] = ObjMapper.readValue[Vector[GroupByResponse]](json)
}
}
________________________________________________________________________________________________________________
type arguments [gwi.druid.client.SelectQuery,gwi.druid.client.SelectResponse,Option] do not conform to trait ResponseReader's type parameter bounds [Q <: gwi.druid.client.Query,R <: gwi.druid.client.Response,C[X] <: TraversableOnce[X]]
[error] implicit object SelectResponseReader extends ResponseReader[SelectQuery, SelectResponse, Option] {
[error] ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment