Golang database/sql.Tx.Stmt function example
package database/sql
Stmt returns a transaction-specific prepared statement from an existing statement.
Golang database/sql.Tx.Stmt function usage example ( from http://golang.org/pkg/database/sql/#Tx.Stmt )
updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
...
tx, err := db.Begin()
...
res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)
// where the final statement is executed with money + 123.45 and id = 98293203
Reference :
Advertisement
Something interesting
Tutorials
+5.6k Unix/Linux : How to find out the hard disk size?
+16.1k Golang : How to check if input from os.Args is integer?
+6.1k Golang : Measure execution time for a function
+7.1k Golang : Get environment variable
+6.3k Golang : How to get capacity of a slice or array?
+14.5k How to automatically restart your crashed Golang server
+18.8k Golang : Delete duplicate items from a slice/array
+21.5k Golang : How to read float value from standard input ?
+9.7k PHP : Get coordinates latitude/longitude from string
+5.9k Golang : Shuffle array of list
+5k Python : Convert(cast) bytes to string example
+4.9k Python : Find out the variable type and determine the type with simple test