Golang database/sql.Row type and Scan function example
package database/sql
Row is the result of calling QueryRow to select a single row.
Scan copies the columns from the matched row into the values pointed at by dest. If more than one row matches the query, Scan uses the first row and discards the rest. If no row matches the query, Scan returns ErrNoRows.
Golang database/sql.Row type usage example
var username string
err = db.QueryRow("select username from accounts where id = ?", 1).Scan(&username)
if err != nil {
log.Fatal(err)
}
fmt.Println(name)
References :
Advertisement
Something interesting
Tutorials
+4.7k Chrome : How to block socketloop.com links in Google SERP?
+8.2k Golang : Metaprogramming example of wrapping a function
+17.6k Convert JSON to CSV in Golang
+14.6k Golang : How to get URL port?
+21.1k Golang : Sort and reverse sort a slice of strings
+7.3k Golang : Of hash table and hash map
+6.8k Swift : substringWithRange() function example
+15.3k Golang : How to get Unix file descriptor for console and file
+17k Golang : How to save log messages to file?
+8.7k Golang : Find duplicate files with filepath.Walk
+16.8k Golang : Get own process identifier
+4k Detect if Google Analytics and Developer Media are loaded properly or not