Skip to content

Commit

Permalink
Rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
zchenyu committed Jun 23, 2023
1 parent 0525540 commit 0c93d35
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions error_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package postgres
import (
"encoding/json"

"github.com/jackc/pgconn"
"gorm.io/gorm"

"github.com/jackc/pgx/v5/pgconn"
)

var errCodes = map[string]error{
Expand Down
5 changes: 3 additions & 2 deletions error_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package postgres

import (
"errors"
"github.com/jackc/pgx/v5/pgconn"
"gorm.io/gorm"
"testing"

"github.com/jackc/pgconn"
"gorm.io/gorm"
)

func TestDialector_Translate(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
module gorm.io/driver/postgres
module github.com/fw-ai/postgres

go 1.18

require (
github.com/jackc/pgconn v1.14.0
github.com/jackc/pgx/v4 v4.18.1
github.com/jackc/pgx/v5 v5.3.1
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55
)

require (
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0=
github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU=
github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8=
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
Expand Down
4 changes: 2 additions & 2 deletions migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"strings"

"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v4"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/migrator"
Expand Down Expand Up @@ -592,7 +592,7 @@ func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Ro
dialector, _ := m.Dialector.(Dialector)
// use simple protocol
if !m.DB.PrepareStmt && (dialector.Config != nil && (dialector.Config.DriverName == "" || dialector.Config.DriverName == "pgx")) {
d.Statement.Vars = append([]interface{}{pgx.QueryExecModeSimpleProtocol}, d.Statement.Vars...)
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
}
return d
}).Rows()
Expand Down

0 comments on commit 0c93d35

Please sign in to comment.