Nullable columns are annoying and lead to a lot of ugly code. If you can, avoid
them. If not, then you’ll need to use special types from the database/sql
package to handle them, or define your own.
If you want to change selection, open document below and click on "Move attachment"
Working with NULLsts Handling Errors Working with NULLs Working with Unknown Columns The Connection Pool Surprises, Antipatterns and Limitations Related Reading and Resources Working with NULLs Improve this page <span>Nullable columns are annoying and lead to a lot of ugly code. If you can, avoid them. If not, then you’ll need to use special types from the database/sql package to handle them, or define your own. There are types for nullable booleans, strings, integers, and floats. Here’s how you use them: for rows.Next() { var s sql.NullString err := rows.Scan(&s) // check err if s.Valid { Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details