1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 14:00:54 +00:00

fix go1.10.3 orm test failed

This commit is contained in:
astaxie 2018-07-20 22:45:44 +08:00
parent 81f69f12ab
commit 868fc2a29f
2 changed files with 48 additions and 44 deletions

View File

@ -2,7 +2,7 @@ language: go
go: go:
- "1.9.2" - "1.9.2"
- "1.10.2" - "1.10.3"
services: services:
- redis-server - redis-server
- mysql - mysql

View File

@ -433,53 +433,57 @@ var (
dDbBaser dbBaser dDbBaser dbBaser
) )
func init() { var (
Debug, _ = StrTo(DBARGS.Debug).Bool() helpinfo = `need driver and source!
if DBARGS.Driver == "" || DBARGS.Source == "" { Default DB Drivers.
fmt.Println(`need driver and source!
Default DB Drivers.
driver: url driver: url
mysql: https://github.com/go-sql-driver/mysql mysql: https://github.com/go-sql-driver/mysql
sqlite3: https://github.com/mattn/go-sqlite3 sqlite3: https://github.com/mattn/go-sqlite3
postgres: https://github.com/lib/pq postgres: https://github.com/lib/pq
tidb: https://github.com/pingcap/tidb tidb: https://github.com/pingcap/tidb
usage: usage:
go get -u github.com/astaxie/beego/orm go get -u github.com/astaxie/beego/orm
go get -u github.com/go-sql-driver/mysql go get -u github.com/go-sql-driver/mysql
go get -u github.com/mattn/go-sqlite3 go get -u github.com/mattn/go-sqlite3
go get -u github.com/lib/pq go get -u github.com/lib/pq
go get -u github.com/pingcap/tidb go get -u github.com/pingcap/tidb
#### MySQL #### MySQL
mysql -u root -e 'create database orm_test;' mysql -u root -e 'create database orm_test;'
export ORM_DRIVER=mysql export ORM_DRIVER=mysql
export ORM_SOURCE="root:@/orm_test?charset=utf8" export ORM_SOURCE="root:@/orm_test?charset=utf8"
go test -v github.com/astaxie/beego/orm go test -v github.com/astaxie/beego/orm
#### Sqlite3 #### Sqlite3
export ORM_DRIVER=sqlite3 export ORM_DRIVER=sqlite3
export ORM_SOURCE='file:memory_test?mode=memory' export ORM_SOURCE='file:memory_test?mode=memory'
go test -v github.com/astaxie/beego/orm go test -v github.com/astaxie/beego/orm
#### PostgreSQL #### PostgreSQL
psql -c 'create database orm_test;' -U postgres psql -c 'create database orm_test;' -U postgres
export ORM_DRIVER=postgres export ORM_DRIVER=postgres
export ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable" export ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable"
go test -v github.com/astaxie/beego/orm go test -v github.com/astaxie/beego/orm
#### TiDB #### TiDB
export ORM_DRIVER=tidb export ORM_DRIVER=tidb
export ORM_SOURCE='memory://test/test' export ORM_SOURCE='memory://test/test'
go test -v github.com/astaxie/beego/orm go test -v github.com/astaxie/beego/orm
`) `
)
func init() {
Debug, _ = StrTo(DBARGS.Debug).Bool()
if DBARGS.Driver == "" || DBARGS.Source == "" {
fmt.Println(helpinfo)
os.Exit(2) os.Exit(2)
} }