Why is a wrapper type generated for single column queries of nullable fields? #3945
-
If I write a single column query for a non-nullable field, say |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Related: #2430 |
Beta Was this translation helpful? Give feedback.
-
Having a nullable result from a query doesn't really fit with SQLDelight's APIs. For example consider this query which selects a nullable getContent:
SELECT content FROM table; and then you might call the generated query function like this: tableQueries.getContent().executeAsOneOrNull() // returns a String? The problem is: If this returns |
Beta Was this translation helpful? Give feedback.
Having a nullable result from a query doesn't really fit with SQLDelight's APIs.
For example consider this query which selects a nullable
TEXT
column:and then you might call the generated query function like this:
tableQueries.getContent().executeAsOneOrNull() // returns a String?
The problem is: If this returns
null
, did the query return zero rows? Or was the value ofcontent
in the table just equal tonull
?