Standard library / database/sql/driver

driver.Int32

Converts supported numeric or string values to int64 within the int32 range; rejects overflow. Expected stdout: '7\n'.

Formal Syntax & Structure

go syntaxgo
var Int32 int32Type

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() { fmt.Println(must(driver.Int32.ConvertValue("7"))) }
Go Reference