Skip to content

Instantly share code, notes, and snippets.

/post.scala
Created Aug 10, 2017

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
You can’t perform that action at this time.