Golang database/sql/driver.NotNull type and ConvertValue function example
package database/sql/driver
NotNull is a type that implements ValueConverter by disallowing nil values but otherwise delegating to another ValueConverter.
Golang database/sql/driver.NotNull type usage and ConvertValue function example
type NotNull struct {
Converter ValueConverter
}
func (n NotNull) ConvertValue(v interface{}) (Value, error) {
if v == nil {
return nil, fmt.Errorf("nil value not allowed")
}
return n.Converter.ConvertValue(v)
}
References :
https://golang.org/src/pkg/database/sql/driver/types.go
http://golang.org/pkg/database/sql/driver/#NotNull
http://golang.org/pkg/database/sql/driver/#NotNull.ConvertValue
Advertisement
Something interesting
Tutorials
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+18.2k Golang : Get path name to current directory or folder
+5.4k How to check with curl if my website or the asset is gzipped ?
+22.6k Generate checksum for a file in Go
+7.1k Golang : Get Alexa ranking data example
+25.7k Golang : missing Mercurial command
+14.8k Golang : Find commonalities in two slices or arrays example
+11.2k CodeIgniter : How to check if a session exist in PHP?
+11.5k CodeIgniter : Import Linkedin data
+16.4k CodeIgniter/PHP : Create directory if does not exist example
+14.1k Golang : Check if a file exist or not
+6.9k Golang : Calculate BMI and risk category