Difficult to build part of data fetching #2972
Replies: 2 comments
-
the most important is why I SHOULD convert data from database with different colomn names to adapt to the graphql schema, and now we must adapt result from schema to the View object with some page nums, total nums properties. In restful api, I only need to map data from different colomn to dto or vo and I can output result after http requests。 |
Beta Was this translation helpful? Give feedback.
-
Sorry I am not sure of the question being asked. I think it's something along the lines of your database schema column names not matching your graphql schema field names. If I have that right, then it would be possible to use a custom data fetcher that map DB names to field names say You could use directives on the graphql schema to put in the naming mapping and then have the common DataFetcher interpret them. Say
This requires custom code but once written everything with that directive can be mapped systemically. |
Beta Was this translation helpful? Give feedback.
-
Project uses graphql-java, now. We define schema files(type/input/query/mutation etc...) for over 80 Entity Objects. But now, we find its difficult to get data from class DatafetchingEnvironment, which defined as "env" in data fetching part. I find Some Class extends GraphQLQueryResolver(these Class as same as Controller in SpringMVC?) , we get "env" from these class. But now, I can get some infomation about schema and data from env, But how I cant build Map from schema to Entity Objects or dataset colomn. I found some js in graphql-dataloader(is that mean frontend programmer can get data by sql without any data fetching part and how can i do
Beta Was this translation helpful? Give feedback.
All reactions