Golang database/sql.NullInt64 type examples
package database/sql
NullInt64 represents an int64 that may be null. NullInt64 implements the Scanner interface so it can be used as a scan destination, similar to NullString.
Golang database/sql.NullInt64 type usage examples
Example 1:
var ni64 = sql.NullInt64{Valid: true}
Example 2:
// NullInt64
var ni sql.NullInt64
// Invalid
if err = nullStmt.QueryRow().Scan(&ni); err != nil {
dbt.Fatal(err)
}
if ni.Valid {
dbt.Error("Valid NullInt64 which should be invalid")
}
References :
https://github.com/go-sql-driver/mysql/blob/master/driver_test.go
Advertisement
Something interesting
Tutorials
+24k Golang : Find biggest/largest number in array
+15.4k Golang : invalid character ',' looking for beginning of value
+7.5k Golang : Gorrila set route name and get the current route name
+15.8k Golang : How to login and logout with JWT example
+14k Golang : Compress and decompress file with compress/flate example
+19.5k Golang : Example for DSA(Digital Signature Algorithm) package functions
+9.9k Golang : ffmpeg with os/exec.Command() returns non-zero status
+12.1k Golang : convert(cast) string to integer value
+33.6k Golang : How to check if slice or array is empty?
+9.4k Golang : Generate EAN barcode
+18.9k Golang : Read input from console line
+11.7k Golang : Calculations using complex numbers example