This repository has been archived by the owner on May 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Support for suspendable property resolvers #38
Comments
Would to see this feature as well! So I could use With suspend resolver we could use |
I've been thinking about implementing a dataloader directly into this project. Haven't figured exactly how to archive it yet, but I'm thinking something like this? ...
data class Tree(val id: String, val parentId: String?)
...
type<Tree> {
// String - defines the key that will be sent from the [prepare] into [loader]
// List<Tree> - defines the return type that the [loader] is required to return.
// the loader is then required to return it in a map format like Map<String, List<Tree>>
dataProperty<String, List<Tree>>("children") {
// Step 2: This will only be called once.
loader { keys: List<String> ->
keys.map{ id -> id to listOf(Tree("SomeId", id)) }.toMap()
}
// Step 1: This will be called for each node in the list, or only once if it's not a list
prepare { parent: Tree -> parent.id }
// Step 3(Optional): This will be called as many times as the prepare did, but now holds the loaded values
resolve { resolved: List<Tree> -> resolved } // This could maybe process something extra and then return some other type instead of List<Tree>
}
...
} Please come with any ideas how something like this could look like. |
jeggy
added a commit
to jeggy/KGraphQL
that referenced
this issue
Jan 26, 2019
jeggy
added a commit
to jeggy/KGraphQL
that referenced
this issue
Feb 2, 2019
jeggy
added a commit
to jeggy/KGraphQL
that referenced
this issue
Feb 6, 2019
jeggy
added a commit
to jeggy/KGraphQL
that referenced
this issue
Feb 6, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Would be great with suspendable property resolvers. Something like #37. But something that actually works.
I haven't gotten a full overview of how everything in this project works yet, so I failed implementing this. If there is anything I can help out with I would love to.
The text was updated successfully, but these errors were encountered: