New types and related infrastructure are added to the `db` package to allow wrapping gorp DbMaps and Transactions. The wrapped versions return a special `db.ErrDatabaseOp` error type when errors occur. The new error type includes additional information such as the operation that failed and the related table. Where possible we determine the table based on the types of the gorp function arguments. Where that isn't possible (e.g. with raw SQL queries) we try to use a simple regexp approach to find the table name. This isn't great for general SQL but works well enough for Boulder's existing SQL queries. To get additional confidence my regexps work for all of Boulder's queries I temporarily changed the `db` package's `tableFromQuery` function to panic if the table couldn't be determined. I re-ran the full unit and integration test suites with this configuration and saw no panics. Resolves https://github.com/letsencrypt/boulder/issues/4559 |
||
|---|---|---|
| .. | ||
| map.go | ||
| map_test.go | ||
| mocks.go | ||
| rollback.go | ||
| rollback_test.go | ||
| transaction.go | ||