Is it possible to query our own resolvers? We can ...
# prisma-whats-new
m
Is it possible to query our own resolvers? We can do
ctx.db.query.PrismaResolver()
, but can we something like
ctx.query.OurResolver()
? I can't seem to find this in the docs. Currently I am just importing the resolver, is there another way?
d
and what's wrong about importing it? it's just a function after all 🙂 however, I believe you can use makeExecutableSchema from graphql-tools and then you can run the query the "official way" 🙂
l
Like Daniel said, I import my resolvers frequently
m
Oh, I was doing it that way but then I thought there might be a way I could just run them like I do the Prisma resolvers. I guess I will just continue to do that because it is easy enough! Thank you lol
l
Probably the better approach is abstracting the functionality inside the resolver and calling that function from different resolvers, but whatevs 🙂
m
Wait, what do you mean exactly?
l
Taking the logic to reuse into its own function
m
Ah, thanks for clarifying 🙂 That is pretty much what I am doing right now and it is working well
l
If you have three or more instances of calling a resolver internally, then it might make sense. It might not. Just tossing it out there
Great!
I just find that resolvers can be difficult building blocks because they're often changing. So if you can make simple functions for those building blocks, that leads to the best reuse and less stress
m
Good point 🙂