getDB either returns the current tx (if one is present) or c.db.
(ctx context.Context)
| 56 | |
| 57 | // getDB either returns the current tx (if one is present) or c.db. |
| 58 | func (c *connection) getDB(ctx context.Context) dbHandle { |
| 59 | tx := txFromContext(ctx) |
| 60 | if tx == nil { |
| 61 | return c.db |
| 62 | } |
| 63 | return tx |
| 64 | } |
| 65 | |
| 66 | // noopTx implements a database.Tx that does nothing on Commit/Rollback. |
| 67 | // It is used in nested transactions to avoid committing too early. |
no test coverage detected