These are chat archives for 47deg/fetch

Apr 2018
Binh Nguyen
Apr 12 12:41

If I have one single data source (think of a document db that stores JSON documents). Then the data source can be like:

implict object JsonStore extends DataSource[String, JSON]{
  def name: String = ???
  def fetchOne(id: Identity): Query[Option[Result]] = ???
  def fetchMany(ids: NonEmptyList[Identity]): Query[Map[Identity, Result]] = ???

Now, we store more than one kinds of document there. Says, User and Post. We also have UserId and PostId that basically wrap a String and enforce certain format for each ids. And UserModel and PostModel are case classes that could be serialized to JSON. What is the right way to have two data sources that return both data types and can batch and cache results for both?