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
+7.4k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+7.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+14.5k Golang : How to determine if user agent is a mobile device example
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+7.9k Setting $GOPATH environment variable for Unix/Linux and Windows
+10k Golang : Read file and convert content to string
+33k Golang : How to check if a date is within certain range?
+10.8k PHP : Convert(cast) bigInt to string
+28.2k Golang : Connect to database (MySQL/MariaDB) server
+13.5k Golang : How to get year, month and day?
+11.2k Golang : How to pipe input data to executing child process?
+19.7k Golang : Archive directory with tar and gzip