Open fwbrasil opened 8 years ago
schema
case class User(id: Int, name: String, username: String, age: Int, friends: List[User])
target query
{ user(id: 1) { name age friends { name } } }
Option 1 - Translate collection-like queries to GraphQL
val q = quote { (id: Int) => query[User].filter(_.id == id).map { user => (user.name, user.age, user.friends.map(_.name)) } }
Option 2 - Create a new DSL similar to the target lang
val q = quote { (id: Int) => query[User](_.id -> id)( _.name, _.age, _.friends( _.name ) ) }
I'm leaning toward the first option.
+1
schema
target query
Option 1 - Translate collection-like queries to GraphQL
Option 2 - Create a new DSL similar to the target lang
I'm leaning toward the first option.