Skip to content

Should operations be returning sql.ErrNoRows, if they return a pointer anyway? #1237

Answered by stephenafamo
preslavrachev asked this question in Q&A
Discussion options

You must be logged in to vote

If asking for a single record, it is an error if none exists, but if asking for a list, you can get an empty list.

This is to match the behavior of the standard library.

  • Query and QueryContext do not return sql.ErrNoRows
  • QueryRow and QueryRowContext return sql.ErrNoRows

So in SQLBoiler, Find, One return sql.ErrNoRows while All does not.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stephenafamo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants