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
+33k Golang : All update packages with go get command
+6.4k Golang : Get expvar(export variables) to work with multiplexer
+15.5k Golang : Get file permission
+7.7k Golang : Emulate NumPy way of creating matrix example
+13.6k Golang : Check if a file exist or not
+15.3k Golang : Read large file with bufio.Scanner cause token too long error
+23.5k Golang : Call function from another package
+11.8k Golang : How to display image file or expose CSS, JS files from localhost?
+8.6k Golang : How to use Gorilla webtoolkit context package properly
+6.1k Golang : When to use make or new?
+10.6k Golang : Create S3 bucket with official aws-sdk-go package