Skip to content

Why is a wrapper type generated for single column queries of nullable fields? #3945

Answered by dellisd
humblehacker asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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 null, did the query return zero rows? Or was the value of content in the table just equal to null?

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@humblehacker
Comment options

Answer selected by AlecKazakova
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants