You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forgive me if this already exists, but I think it would be neat and rather useful if you could compose define several instances of select! and include!. Currently, when working with complex schemas involving multiple models and nested relations, it can be a tedious process to repeatedly specify all the fields to be included or selected.
Here is a rendered example of what I think an enhanced select! and include! could look like
// Define a 'select' directive for Foo that only fetches 'name'// This could be used in situations where only the 'name' field is required.
foo::select!(foo_summary {
name
})// Define a more detailed 'select' directive for Foo// This fetches 'name' and includes 'bar' relations using a nested 'include' directive, 'bar_with_children'
foo::select!(foo_detailed {
name
bar: bar_with_children // Include the contents of bar_with_children})// Define an 'include' directive for Bar// This specifies what child relations and fields to fetch when a Bar instance is requested.
bar::include!(bar_with_children {
baz: select {
thud // When fetching 'baz', only get the 'thud' field}
bongo: select {
grunt // When fetching 'bongo', only get the 'grunt' field}});
Thank you very much for the wonderful library!
The text was updated successfully, but these errors were encountered:
Forgive me if this already exists, but I think it would be neat and rather useful if you could compose define several instances of
select!
andinclude!
. Currently, when working with complex schemas involving multiple models and nested relations, it can be a tedious process to repeatedly specify all the fields to be included or selected.Consider the following Prisma schema:
Here is a rendered example of what I think an enhanced
select!
andinclude!
could look likeThank you very much for the wonderful library!
The text was updated successfully, but these errors were encountered: