Golang database/sql.Tx.Query function examples
package database/sql
Query executes a query that returns rows, typically a SELECT.
Golang database/sql.Tx.Query function usage examples
Example 1:
rows, err := txn.Query("CREATE TEMP TABLE foo(f1 int)")
if err != nil {
t.Fatal(err)
}
Example 2:
var nick string
row, err := tx.Query(`select score from plusplus where nick = ?`, strings.ToLower(nick))
if err != nil {
fmt.Printf("Database error: %v\n", err)
return
}
Reference :
Advertisement
Something interesting
Tutorials
+6.9k Mac/Linux/Windows : Get CPU information from command line
+11.3k Golang : Byte format example
+10.4k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+52.6k Golang : How to get struct field and value by name
+21.2k Golang : Clean up null characters from input data
+29.9k Golang : Get and Set User-Agent examples
+14.6k Golang : How to get URL port?
+10.8k Android Studio : Checkbox for user to select options example
+12.3k Golang : Display list of countries and ISO codes
+6k Golang : Compound interest over time example
+21.1k Golang : For loop continue,break and range