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
+16.1k Golang : Generate universally unique identifier(UUID) example
+6.5k Unix/Linux : How to get own IP address ?
+40.1k Golang : UDP client server read write example
+5k Python : Convert(cast) bytes to string example
+25.6k Golang : convert rune to integer value
+12.2k Golang : Simple client-server HMAC authentication without SSL example
+11.1k Golang : Roll the dice example
+6.1k Golang : Scan forex opportunities by Bollinger bands
+6.8k Golang : Find the longest line of text example
+12.4k Golang : Extract part of string with regular expression
+31.7k Golang : How to convert(cast) string to IP address?
+9.1k Golang : Gonum standard normal random numbers example