//go:build integration package postgres import ( "github.com/jackc/pgx/v5" "lincodex/backend/internal/port/outbound" ) // TransactionForIntegrationTest exposes the transaction behind a unit of work // to integration tests that write test-only tables. It is compiled only with // the integration build tag and is not part of the adapter API. func TransactionForIntegrationTest(unit outbound.UnitOfWork) (pgx.Tx, bool) { postgresUnit, ok := unit.(*UnitOfWork) if !ok { return nil, false } return postgresUnit.tx, true } // MapPolicyErrorForIntegrationTest applies the policy error mapping to an // error from a raw statement, so integration tests can prove that the // database refusal of a policy change becomes the port sentinel. It is // compiled only with the integration build tag. func MapPolicyErrorForIntegrationTest(err error) error { return mapPolicyError(err) }