Golang database/sql.Tx.Commit function examples
package database/sql
Commit commits the transaction.
Golang database/sql.Tx.Commit function usage examples
Example 1:
err = tx.Commit()
if err != nil {
t.Fatal("could not commit transaction.", err)
}
Example 2:
if tx, err := db.Begin(); err == nil {
dbutil.DbInsert2(tx, "insert into ttable(tname,titem,tval,status,time) values('name','item','val','N',now())")
tx.Commit()
}
Reference :
Advertisement
Something interesting
Tutorials
+20.7k Golang : Saving private and public key to files
+10.2k Golang : Text file editor (accept input from screen and save to file)
+7.1k Golang : Validate credit card example
+30.5k Get client IP Address in Go
+16.9k Golang : Set up source IP address before making HTTP request
+17.9k Golang : Simple client server example
+10.7k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+7.2k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+10k Golang : Convert octal value to string to deal with leading zero problem
+5.3k Golang : Get FX sentiment from website example
+12.7k Golang : Pass database connection to function called from another package and HTTP Handler
+6.1k Java : Human readable password generator