Standard library / database/sql/driver

driver.DefaultParameterConverter

Converts supported argument types to driver values, including widening integers to int64; rejects unsupported values. Expected stdout: 'int64 7\n'.

Formal Syntax & Structure

go syntaxgo
var DefaultParameterConverter defaultConverter

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() {  v := must(driver.DefaultParameterConverter.ConvertValue(int16(7)))  fmt.Printf("%T %v\n", v, v)}
Go Reference