-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create an entity where (most) fields and the type are only known at runtime? #957
Comments
@scott-wilson you're going in the right direction by implementing First, to play well with other types, it's better to provide implementation not for Second, don't forget about implementing required |
Would be nice if there was a more complex version of this test: Where it shows how to make the |
I'm taking a stab a doing what I mentioned above.. see: Basically you can define a schema by parsing a graphql SDL, and the resolved data comes from a serde_json Value. the basics seems to work. But It seems like it's going to get very complicated to deal with nested list types and such. |
There might be some ideas in https://github.com/davidpdrsn/juniper-from-schema as well |
First of all, thanks for the help so far. It looks like I'm a step closer to no compile errors. The entity type looks done now, but I'm getting the following compile error on the Query type when I have the entity's type_info a simple i32 (just for testing).
How do I get the Query type to use the i32 info type while using the macro? Or would I have to implement the query by hand to get that? |
@scott-wilson by any chance are you intending on open sourcing your implementation? I have a similar problem and would love to see how you tackle it. |
Yeah, I'm slowly working on an interface to a graph DB that can be used in
the VFX industry (stuff like shots, assets, etc). Hopefully it'll be open
sourced once I get more done in it.
…On Fri, Jan 21, 2022, 10:59 PM Chiru B ***@***.***> wrote:
@scott-wilson <https://github.com/scott-wilson> by any chance are you
intending on open sourcing your implementation? I have a similar problem
and would love to see how you tackle it.
—
Reply to this email directly, view it on GitHub
<#957 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVFQOHGPUTA523AYAHOE4TUXJIV5ANCNFSM5AESHN3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Here is our implementation: https://github.com/ForetagInc/Alchemy/blob/dev/engine/src/api/schema/mod.rs it's still a WIP, happy for people to comment/provide feedback on. |
I have a project where I want to be able to have the database drive the entity types and (most) fields at runtime.
There's two questions I have. Firstly I get a compiler error when hooking up the entity type to the schema through the
find_entity
method in the query type (code and error below). I know I'm missing something, but is there an example of an entity where the type and the fields are known at runtime? Also, it looks like the meta method doesn't have any way to communicate with the database. The answer to this question will likely tie in with the main question, but is there a way for an entity to get its type from the context?Thank you!
Entity type
Schema
Compiler Error
The text was updated successfully, but these errors were encountered: