brysgo / graphql-gun

A graphql API for the gun p2p graph database
405 stars 20 forks source link

Feature request: custom resolvers / advanced querying #115

Open brysgo opened 4 years ago

brysgo commented 4 years ago

This is probably the most requested feature, basically people want to write resolvers like they do with graphql. There are two approaches to making this happen:

  1. Write an option to pass in resolvers that has a function to dynamically determine the type

or

  1. Switch from using forked graphql-anywhere to graphql-js

Option 2 would be a large undertaking and I'm not 100% sure how we would handle live queries, option 1 is much better to me, and if you are using typescript, we could default the dynamic type lookup to the typescript type.

brysgo commented 4 years ago

@ivanmhale - this one is for you

ansarizafar commented 3 years ago

@brysgo Is there any update on this issue?

brysgo commented 3 years ago

I haven't heard anything, if you have the bandwidth and energy to make a push for new features I'd be happy to review them.

ansarizafar commented 3 years ago

I am just a beginner, so I don't know how to do it.

zcaudate commented 3 years ago

@brysgo: I agree with what you are saying about the 2 ways of doing it. Basically option 1 involves breaking up the graphql query into pieces and then applying each piece to the data - which is doable if it's possible to somehow turn the graphql query into json format.

I asked here: https://github.com/amark/gun/issues/1115 but maybe you might know how the graphql parsing works