Standard library / database/sql/driver
driver.Result
Driver contract for generated IDs and affected rows. Unsupported operations may return errors. Expected stdout: '3\n'.
Formal Syntax & Structure
go syntaxgo
type Result interface { LastInsertId() (int64, error)
RowsAffected() (int64, error)}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() { var r driver.Result = driver.RowsAffected(3); fmt.Println(must(r.RowsAffected())) }