diff --git a/association_test.go b/association_test.go index c84f84ed..d765ddeb 100644 --- a/association_test.go +++ b/association_test.go @@ -7,7 +7,7 @@ import ( "sort" "testing" - "github.com/jinzhu/gorm" + "gorm" ) func TestBelongsTo(t *testing.T) { diff --git a/callbacks_test.go b/callbacks_test.go index a58913d7..19bd2ebc 100644 --- a/callbacks_test.go +++ b/callbacks_test.go @@ -3,7 +3,7 @@ package gorm_test import ( "errors" - "github.com/jinzhu/gorm" + "gorm" "reflect" "testing" diff --git a/customize_column_test.go b/customize_column_test.go index ddb536b8..42c0b672 100644 --- a/customize_column_test.go +++ b/customize_column_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/jinzhu/gorm" + "gorm" ) type CustomizeColumn struct { diff --git a/dialect_pgx.go b/dialect_pgx.go new file mode 100644 index 00000000..5ed73586 --- /dev/null +++ b/dialect_pgx.go @@ -0,0 +1,13 @@ +package gorm + +type pgx struct { + postgres +} + +func init() { + RegisterDialect("pgx", &pgx{}) +} + +func (pgx) GetName() string { + return "pgx" +} \ No newline at end of file diff --git a/dialects/pgx/pgx.go b/dialects/pgx/pgx.go new file mode 100644 index 00000000..08ddf1ed --- /dev/null +++ b/dialects/pgx/pgx.go @@ -0,0 +1,3 @@ +package pgx + +import _ "github.com/jackc/pgx/stdlib" \ No newline at end of file diff --git a/errors_test.go b/errors_test.go index 9a428dec..b8721429 100644 --- a/errors_test.go +++ b/errors_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/jinzhu/gorm" + "gorm" ) func TestErrorsCanBeUsedOutsideGorm(t *testing.T) { diff --git a/field_test.go b/field_test.go index 30e9a778..249111d2 100644 --- a/field_test.go +++ b/field_test.go @@ -3,7 +3,7 @@ package gorm_test import ( "testing" - "github.com/jinzhu/gorm" + "gorm" ) type CalculateField struct { diff --git a/join_table_test.go b/join_table_test.go index 6d5f427d..f09c5bd0 100644 --- a/join_table_test.go +++ b/join_table_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/jinzhu/gorm" + "gorm" ) type Person struct { diff --git a/main_test.go b/main_test.go index 34f96a86..7ba5d04b 100644 --- a/main_test.go +++ b/main_test.go @@ -12,11 +12,12 @@ import ( "time" "github.com/erikstmartin/go-testdb" - "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/mssql" - _ "github.com/jinzhu/gorm/dialects/mysql" - "github.com/jinzhu/gorm/dialects/postgres" - _ "github.com/jinzhu/gorm/dialects/sqlite" + "gorm" + _ "gorm/dialects/mssql" + _ "gorm/dialects/mysql" + "gorm/dialects/postgres" + _ "gorm/dialects/sqlite" + _ "gorm/dialects/pgx" "github.com/jinzhu/now" ) @@ -54,6 +55,13 @@ func OpenTestConnection() (db *gorm.DB, err error) { dbhost = fmt.Sprintf("host=%v ", dbhost) } db, err = gorm.Open("postgres", fmt.Sprintf("%vuser=gorm password=gorm DB.name=gorm sslmode=disable", dbhost)) + case "pgx": + fmt.Println("testing pgx...") + dbhost := os.Getenv("GORM_DBHOST") + if dbhost != "" { + dbhost = fmt.Sprintf("host=%v ", dbhost) + } + db, err = gorm.Open("pgx", fmt.Sprintf("%vuser=gorm password=gorm database=gorm sslmode=disable", dbhost)) case "foundation": fmt.Println("testing foundation...") db, err = gorm.Open("foundation", "dbname=gorm port=15432 sslmode=disable") diff --git a/migration_test.go b/migration_test.go index 3f3a5c8f..04e251a1 100644 --- a/migration_test.go +++ b/migration_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/jinzhu/gorm" + "gorm" ) type User struct { diff --git a/preload_test.go b/preload_test.go index 1b89e77b..081717ea 100644 --- a/preload_test.go +++ b/preload_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/jinzhu/gorm" + "gorm" ) func getPreloadUser(name string) *User { diff --git a/query_test.go b/query_test.go index def84e04..909f01b6 100644 --- a/query_test.go +++ b/query_test.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - "github.com/jinzhu/gorm" + "gorm" "testing" "time" diff --git a/scaner_test.go b/scaner_test.go index 9e251dd6..993eb464 100644 --- a/scaner_test.go +++ b/scaner_test.go @@ -6,7 +6,7 @@ import ( "errors" "testing" - "github.com/jinzhu/gorm" + "gorm" ) func TestScannableSlices(t *testing.T) { diff --git a/scope_test.go b/scope_test.go index 42458995..57c73870 100644 --- a/scope_test.go +++ b/scope_test.go @@ -1,7 +1,7 @@ package gorm_test import ( - "github.com/jinzhu/gorm" + "gorm" "testing" ) diff --git a/update_test.go b/update_test.go index 85d53e5f..9039998a 100644 --- a/update_test.go +++ b/update_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/jinzhu/gorm" + "gorm" ) func TestUpdate(t *testing.T) { diff --git a/utils_test.go b/utils_test.go index 152296d2..7c05f393 100644 --- a/utils_test.go +++ b/utils_test.go @@ -3,7 +3,7 @@ package gorm_test import ( "testing" - "github.com/jinzhu/gorm" + "gorm" ) func TestToDBNameGenerateFriendlyName(t *testing.T) {