SharedTx can be used to wrap a test transaction in cases where multiple callers may want to access it concurrently during the course of a single test case. Normally this is not allowed and an access will error with "conn busy" if another caller is already using it. This is a test-only construct bec
| 26 | // encountered by use of concurrent accesses will be more difficult to debug |
| 27 | // than otherwise, so it's better to not go there at all if it can be avoided. |
| 28 | type SharedTx struct { |
| 29 | inner pgx.Tx |
| 30 | wait chan struct{} |
| 31 | } |
| 32 | |
| 33 | func NewSharedTx(tx pgx.Tx) *SharedTx { |
| 34 | wait := make(chan struct{}, 1) |
nothing calls this directly
no outgoing calls
no test coverage detected