Created
February 24, 2016 19:46
-
-
Save l15k4/aa17cb6266efd37fa579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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