newTx creates a new transactional driver.
(ctx context.Context, drv dialect.Driver)
| 229 | |
| 230 | // newTx creates a new transactional driver. |
| 231 | func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) { |
| 232 | tx, err := drv.Tx(ctx) |
| 233 | if err != nil { |
| 234 | return nil, err |
| 235 | } |
| 236 | return &txDriver{tx: tx, drv: drv}, nil |
| 237 | } |
| 238 | |
| 239 | // Tx returns the transaction wrapper (txDriver) to avoid Commit or Rollback calls |
| 240 | // from the internal builders. Should be called only by the internal builders. |