davidpdrsn/graphql-app-example

Interface example

OskarPersson opened this issue · 3 comments

How would an interface be implemented in this example?

I'm thinking of something like in the official example to both list all the Characters or only Humans or Droids.

How would juniper-from-schema and juniper-eager-loading be used together with Diesel to avoid N+1 queries in these lists?

Hm thats a great question. Come to think of it juniper-eager-loading doesn't support interfaces and unions. I have to spend time thinking about how to make that work.

I just opened davidpdrsn/juniper-eager-loading#15 about this.

Hey! Just FYI I haven't forgotten about this. I came home from vacation last week so I should get time to look into it soon-ish. Dunno exactly when.

Hey. I finally got around to solving this. It required a few unexpected changes in juniper-from-schema and juniper-eager-loading. However version 0.4.0 and 0.3.0 respectively (the latest) support it. More info here https://docs.rs/juniper-eager-loading/0.3.0/juniper_eager_loading/#eager-loading-interfaces-or-unions

If you’re looking for a full example this juniper-eager-loading test should help https://github.com/davidpdrsn/juniper-eager-loading/blob/master/juniper-eager-loading/tests/interfaces.rs

I’m gonna close this but just let me know if you have more questions.