Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2017 06:32
Show Gist options
  • Save anonymous/09087dc2952ac20eb71fc711a886bc41 to your computer and use it in GitHub Desktop.
Save anonymous/09087dc2952ac20eb71fc711a886bc41 to your computer and use it in GitHub Desktop.
the description for this gist
trait Language[Wrapper[_]] {
type QueryObj
case class Raw(q: QueryObj)
case class WithFilter(q: QueryObj)
case class WithPagination(q: QueryObj)
def people(): Wrapper[Raw]
// we could change plain Ints into our custom class, but will skip it for brevity
def filterByIds(query: Wrapper[Raw], ids: Seq[Int]): Wrapper[WithFilter]
def paginate(query: Wrapper[WithFilter], skip: Int, limit: Int): Wrapper[WithPagination]
def run(query: Wrapper[WithPagination]): Wrapper[Seq[Person]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment