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
+8.9k Golang : Sort lines of text example
+6.8k Golang : Find the longest line of text example
+10.2k Golang : Random Rune generator
+5.2k Python : Create Whois client or function example
+11.3k Golang : How to use if, eq and print properly in html template
+9k Golang : Capture text return from exec function example
+17.6k Golang : Upload/Receive file progress indicator
+19.6k Golang : Set or Add HTTP Request Headers
+5.4k Gogland : Datasource explorer
+8.8k Golang : Random integer with rand.Seed() within a given range
+6.9k Mac/Linux/Windows : Get CPU information from command line
+6.1k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)