| 1 | // Copyright 2016 Qiang Xue. All rights reserved. |
| 2 | // Use of this source code is governed by a MIT-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package dbx |
| 6 | |
| 7 | import "database/sql" |
| 8 | |
| 9 | // Tx enhances sql.Tx with additional querying methods. |
| 10 | type Tx struct { |
| 11 | Builder |
| 12 | tx *sql.Tx |
| 13 | } |
| 14 | |
| 15 | // Commit commits the transaction. |
| 16 | func (t *Tx) Commit() error { |
| 17 | return t.tx.Commit() |
| 18 | } |
| 19 | |
| 20 | // Rollback aborts the transaction. |
| 21 | func (t *Tx) Rollback() error { |
| 22 | return t.tx.Rollback() |
| 23 | } |