Skip to content

Get(): don't hide an sql.ErrNoRows error.#13

Open
jsha wants to merge 3 commits intomainfrom
no-hide-error
Open

Get(): don't hide an sql.ErrNoRows error.#13
jsha wants to merge 3 commits intomainfrom
no-hide-error

Conversation

@jsha
Copy link
Copy Markdown

@jsha jsha commented Apr 24, 2026

The behaviour for Get() was notably different than SelectOne(). Get() filters ErrNoRows and returns a nil object instead. SelectOne() takes a successful result that returned no rows, and specifically returns sql.ErrNoRows for it.

Consolidate on returning ErrNoRows.

Note that there are a number of other functions that share Get()'s behavior of returning a default value on ErrNoRows:

  • SelectFloat
  • SelectNullFloat
  • SelectInt
  • SelectNullInt
  • SelectStr
  • SelectNullStr

I haven't touched these in this PR. They are mostly unused in Boulder, with the small exception of SelectNullInt. My plan is to remove all references to these from Boulder, then remove them from this repo.

aarongable
aarongable previously approved these changes Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants