Standard library / database/sql/driver
driver.Null
Wraps a converter and accepts nil without conversion; other values are delegated to Converter. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type Null struct { Converter ValueConverter}Working Example
Example Snippetgo
package main
import ( "database/sql/driver" "fmt")
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}func main() { c := driver.Null{Converter: driver.DefaultParameterConverter} v := must(c.ConvertValue(nil)) fmt.Println(v == nil)}