Standard library / database/sql/driver

driver.Null.ConvertValue()

Accepts nil directly and delegates other values to the configured converter. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (n Null) ConvertValue(v any) (Value, error)

Parameters & Attributes

NameTypeDescription
vanyInput to the operation as described above.

Return Value

(Value, error)

Accepts nil directly and delegates other values to the configured converter. Check returned errors where applicable.

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}  fmt.Println(must(c.ConvertValue(nil)) == nil)}
Go Reference