Merge 8909aa382b01ca48e8e115a75ed00f6f771ec6c7 into 38f96c65140f00f0b15efc495a487cfd5db510b8
This commit is contained in:
		
						commit
						c0617fff71
					
				@ -7,7 +7,7 @@ import (
 | 
			
		||||
	"sort"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestBelongsTo(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ package gorm_test
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CustomizeColumn struct {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								dialect_pgx.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								dialect_pgx.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
package gorm
 | 
			
		||||
 | 
			
		||||
type pgx struct {
 | 
			
		||||
	postgres
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	RegisterDialect("pgx", &pgx{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pgx) GetName() string {
 | 
			
		||||
	return "pgx"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								dialects/pgx/pgx.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								dialects/pgx/pgx.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
package pgx
 | 
			
		||||
 | 
			
		||||
import _ "github.com/jackc/pgx/stdlib"
 | 
			
		||||
@ -4,7 +4,7 @@ import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestErrorsCanBeUsedOutsideGorm(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ package gorm_test
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CalculateField struct {
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Person struct {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								main_test.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								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")
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type User struct {
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ import (
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func getPreloadUser(name string) *User {
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"reflect"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestScannableSlices(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
package gorm_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestUpdate(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ package gorm_test
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jinzhu/gorm"
 | 
			
		||||
	"gorm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestToDBNameGenerateFriendlyName(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user