Merge 467e50e89361fe022d546f2b7be33c325c78af59 into adf9b80fb7aa77f25666d1fbe93391bd1086260c
This commit is contained in:
		
						commit
						0e24d68959
					
				
							
								
								
									
										13
									
								
								dialect_tidb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								dialect_tidb.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
package gorm
 | 
			
		||||
 | 
			
		||||
type tidb struct {
 | 
			
		||||
	mysql
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	RegisterDialect("tidb", &tidb{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (tidb) GetName() string {
 | 
			
		||||
	return "tidb"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								dialects/tidb/tidb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								dialects/tidb/tidb.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
package tidb
 | 
			
		||||
 | 
			
		||||
import _ "github.com/pingcap/tidb"
 | 
			
		||||
@ -17,6 +17,7 @@ import (
 | 
			
		||||
	_ "github.com/jinzhu/gorm/dialects/mysql"
 | 
			
		||||
	"github.com/jinzhu/gorm/dialects/postgres"
 | 
			
		||||
	_ "github.com/jinzhu/gorm/dialects/sqlite"
 | 
			
		||||
	_ "github.com/jinzhu/gorm/dialects/tidb"
 | 
			
		||||
	"github.com/jinzhu/now"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -60,6 +61,9 @@ func OpenTestConnection() (db *gorm.DB, err error) {
 | 
			
		||||
	case "mssql":
 | 
			
		||||
		fmt.Println("testing mssql...")
 | 
			
		||||
		db, err = gorm.Open("mssql", "server=SERVER_HERE;database=rogue;user id=USER_HERE;password=PW_HERE;port=1433")
 | 
			
		||||
	case "tidb":
 | 
			
		||||
		fmt.Println("testing tidb...")
 | 
			
		||||
		db, err = gorm.Open("tidb", filepath.Join(os.TempDir(), "goleveldb://gorm"))
 | 
			
		||||
	default:
 | 
			
		||||
		fmt.Println("testing sqlite3...")
 | 
			
		||||
		db, err = gorm.Open("sqlite3", filepath.Join(os.TempDir(), "gorm.db"))
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
dialects=("postgres" "mysql" "sqlite")
 | 
			
		||||
dialects=("postgres" "mysql" "sqlite", "tidb")
 | 
			
		||||
 | 
			
		||||
for dialect in "${dialects[@]}" ; do
 | 
			
		||||
    GORM_DIALECT=${dialect} go test
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,12 @@ build:
 | 
			
		||||
        - script:
 | 
			
		||||
                name: test sqlite
 | 
			
		||||
                code: |
 | 
			
		||||
                    go test ./...
 | 
			
		||||
                    GORM_DIALECT=sqlite3 go test ./...
 | 
			
		||||
 | 
			
		||||
        - script:
 | 
			
		||||
                name: test tidb
 | 
			
		||||
                code: |
 | 
			
		||||
                    GORM_DIALECT=tidb go test ./...
 | 
			
		||||
 | 
			
		||||
        - script:
 | 
			
		||||
                name: test mysql
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user