Skip to content

Instantly share code, notes, and snippets.

@shumon84
Created November 22, 2018 01:51
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 shumon84/a4761152f440845fa3f3544a347915a8 to your computer and use it in GitHub Desktop.
Save shumon84/a4761152f440845fa3f3544a347915a8 to your computer and use it in GitHub Desktop.
stmt1, _ := db.Prepare("INSERT INTO hoge (id) VALUES (?)")
tx, err := db.Begin() // トランザクション開始
stmt2 := tx.Stmt(stmt1)
stmt1.Exec("0000") // トランザクションに含まれない
stmt2.Exec("0000") // トランザクションに含まれる
tx.Commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment