Closed LastDragon-ru closed 9 months ago
Default implementation and default (global) settings
Available in the main
branch 🎉 Any feedback greatly appreciated.
The following syntax was added and will be available in the next major (v6) 🥳
query {
comments(order: [
{nullsFirst: {user: {name: Asc}}}
{nullsLast: {text: Desc}}
])
}
NULL
s order different in different databases. Sometimes we need to change it. There is no default/built-it support in Laravel nor Lighthouse.Useful links:
There are two parts:
For the second part, I think we can add
nulls
extra operator that will change default behaviour. The problem (also related to default config) is: there is no way to know if the column/expression is nullable or not. This is mean thatNULLS FIRST
/NULLS LAST
will be added into allORDER BY
clauses. It may be slow for databases without nativeNULLS FIRST
/NULLS LAST
support (MySQL and SQL Server). Unfortunately, I have no idea how to solve it.The proposed syntax is shown below. Probably both fields should be required (to avoid ambiguity).
Or better (it will affect only one clause):
Related to https://github.com/nuwave/lighthouse/issues/2486, https://github.com/nuwave/lighthouse/issues/2056