Open nikolasburk opened 4 years ago
This question was asked by a community member and I'm relaying it here myself so others can see how to deal with these situations.
With prisma-binding it was also possible to fetch arbitrary data (full graphql query) and also have mutations with multiple operations.
Let's say I have an operation where I supply an ID but the type of the model related to the ID might differ:
query QueryAnimal($id: ID!) { node(id: $id) { id ... on Dog { leashcolor } ... on Cat { woolcolor } } }
Or fetch different types based on the same variable:
query QueryAnimals($id: [ID!]!) { cats(where: {id_in: $ids}) { name favoriteFood } dogs(where: {id_in: $ids}) { name leashcolor } lamas(where: {id_in: $ids}) { cuteness } }
With Prisma1 I can just use client.request(query) to fetch this data. How would I do that with Prisma2?
client.request(query)
This question was asked by a community member and I'm relaying it here myself so others can see how to deal with these situations.
With prisma-binding it was also possible to fetch arbitrary data (full graphql query) and also have mutations with multiple operations.
Let's say I have an operation where I supply an ID but the type of the model related to the ID might differ:
Or fetch different types based on the same variable:
With Prisma1 I can just use
client.request(query)
to fetch this data. How would I do that with Prisma2?