Created
December 21, 2013 02:48
-
-
Save jaekwon/8064762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to use https://github.com/jaekwon/mysql/ | |
conn, _ := sql.Open("mysql", dbHost) | |
// You can't set the level here, the tx connection returned by Begin() isn't guaranteed to | |
// be in the same session | |
// conn.Exec("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE") | |
tx, _ := conn.Begin() | |
// Before would have err'd, can't set after Begin()! | |
tx.Exec("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE") | |
tx.Query(...) | |
tx.Commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment