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
+7k Golang : Takes a plural word and makes it singular
+16.4k Golang : How to implement two-factor authentication?
+30.6k Golang : Remove characters from string example
+41.2k Golang : How to count duplicate items in slice/array?
+6.8k Golang : Calculate pivot points for a cross
+6.7k Golang : Experimental emojis or emoticons icons programming language
+8.8k Golang : Heap sort example
+25.9k Golang : How to read integer value from standard input ?
+13.4k Golang : Verify token from Google Authenticator App
+13.6k Golang : reCAPTCHA example
+4.8k Golang : A program that contain another program and executes it during run-time