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
+6.9k Golang : How to solve "too many .rsrc sections" error?
+12.8k Golang : http.Get example
+9.3k Golang : Temperatures conversion example
+25.3k Golang : Get current file path of a file or executable
+7k Golang : Gargish-English language translator
+6.5k Golang : Calculate diameter, circumference, area, sphere surface and volume
+11.3k Golang : Characters limiter example
+6.1k nginx : force all pages to be SSL
+7.5k Golang : Gorrila set route name and get the current route name
+9.3k Golang : How to get garbage collection data?
+12.1k Golang : Sort and reverse sort a slice of runes
+13.6k Golang : reCAPTCHA example