Skip to content

Instantly share code, notes, and snippets.

@jaekwon
Created December 21, 2013 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaekwon/8064762 to your computer and use it in GitHub Desktop.
Save jaekwon/8064762 to your computer and use it in GitHub Desktop.
// 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