title: Raw sql transactions with golang prepared statements
body: <p>I'm having trouble finding some examples that do three of the following things:</p>
  
  <p>1) Allow raw sql transactions in golang.</p>
  
  <p>2) Use prepared statements.</p>
  
  <p>3) Rollback on query failures.</p>
  
  <p>I would like to do something like this, but with prepared statements.</p>
  
  <pre><code>    stmt, stmt_err := db.Prepare(`
              BEGIN TRANSACTION;
  
              -- Insert record into first table.
  
              INSERT INTO table_1 (
                      thing_1,
                      whatever)
              VALUES($1,$2);
  
              -- Inert record into second table.
  
              INSERT INTO table_2 (
                      thing_2,
                      whatever)
              VALUES($3,$4);
  
              END TRANSACTION;
              `)
      if stmt_err != nil {
              return stmt_err
      }   
      res, res_err := stmt.Exec(
              thing_1,
              whatever,
              thing_2,
              whatever)
  </code></pre>
  
  <p>When I run this, I get this error:
  <code>pq: cannot insert multiple commands into a prepared statement</code></p>
  
  <p>What gives? Are ACID compliant transactions even possible in golang? I cannot find an example.</p>
  
  <p>EDIT
  no examples <a href="http://go-database-sql.org/modifying.html" rel="noreferrer">here</a>.</p>