Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2017 06:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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