Skip to content

[Feature requests]Allow resolve function returns a custom deferred object in order to do decent query optimization. #1416

Open
@JimChengLin

Description

@JimChengLin

I have read #26 , #700 and #304 . It seems like there is no well-agreed way to combine GraphQL and database. GraphQL.js loses a certain amount of chances to do query optimization. Am I right? I have a simple proposal. In the resolve function, we can return a DeferredObject instead of a normal JS object or Promise. Only in the very last moment, the deferred object queries the DB. Does this make sense?

The special DeferredObjects links with each other. So the minimal query fields needed can be detected. GraphQL.js may finally call await someDeferredObject.excute() multiple times. Since we have ES6 getter and setter. I think it may be quite seamless to current code base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions