diff --git a/migrate/migrate.go b/migrate/migrate.go index 26fd05b..840c6a6 100644 --- a/migrate/migrate.go +++ b/migrate/migrate.go @@ -5,10 +5,11 @@ import ( "database/sql" "errors" "fmt" + "time" + "github.com/golang-migrate/migrate/v4" "github.com/golang-migrate/migrate/v4/database/postgres" _ "github.com/golang-migrate/migrate/v4/source/file" - "time" ) const ( diff --git a/migrate/with_vipe.go b/migrate/with_vipe.go index a30875f..e3b03ff 100644 --- a/migrate/with_vipe.go +++ b/migrate/with_vipe.go @@ -2,9 +2,10 @@ package migrate import ( "fmt" - "github.com/spf13/viper" "os" "strings" + + "github.com/spf13/viper" ) var required = []string{"user", "password", "host", "port", "dbname"} diff --git a/pgx/tx.go b/pgx/tx_manager.go similarity index 99% rename from pgx/tx.go rename to pgx/tx_manager.go index 734bffe..65fb1f2 100644 --- a/pgx/tx.go +++ b/pgx/tx_manager.go @@ -3,9 +3,10 @@ package pgx import ( "context" "errors" + "sync/atomic" + "github.com/i4erkasov/go-pgsql/pgxpool" "github.com/jackc/pgx/v4" - "sync/atomic" ) // Tx is an alias to pgx.Tx @@ -174,7 +175,7 @@ func (t *Transactor) beginNestedTx(ctx context.Context) (context.Context, bool, if err != nil { // In case of an error, decrement the counter back. ctx = tickTxCounter(ctx, -1) - return nil, false, err + return ctx, false, err } return ctx, true, nil } diff --git a/pgx/tx_test.go b/pgx/tx_manager_test.go similarity index 99% rename from pgx/tx_test.go rename to pgx/tx_manager_test.go index d024ee5..9de5419 100644 --- a/pgx/tx_test.go +++ b/pgx/tx_manager_test.go @@ -3,10 +3,11 @@ package pgx import ( "context" "errors" + "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" - "testing" ) type txManagerTestSuite struct { diff --git a/pgxpool/pgxpool.go b/pgxpool/pgxpool.go index 51f664b..aa981c5 100644 --- a/pgxpool/pgxpool.go +++ b/pgxpool/pgxpool.go @@ -2,9 +2,10 @@ package pgxpool import ( "fmt" + "strings" + "github.com/jackc/pgx/v4/pgxpool" "github.com/spf13/viper" - "strings" ) // Pool is an alias to pgxpool.Pool