adding mysql support, table creation tested, TODO schema
This commit is contained in:
26
pg_test.go
26
pg_test.go
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreateTable(t *testing.T) {
|
||||
func TestPgCreateTable(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestCreateTable(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddColumn(t *testing.T) {
|
||||
func TestPgAddColumn(t *testing.T) {
|
||||
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
@@ -57,7 +57,7 @@ func TestAddColumn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInsert(t *testing.T) {
|
||||
func TestPgInsert(t *testing.T) {
|
||||
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
@@ -92,7 +92,7 @@ func TestInsert(t *testing.T) {
|
||||
json.Unmarshal(byteValue, &result)
|
||||
}
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
func TestPgUpdate(t *testing.T) {
|
||||
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
@@ -124,7 +124,7 @@ func TestUpdate(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestDelete(t *testing.T) {
|
||||
func TestPgDelete(t *testing.T) {
|
||||
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
@@ -153,7 +153,7 @@ func TestDelete(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteColumn(t *testing.T) {
|
||||
func TestPgDeleteColumn(t *testing.T) {
|
||||
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
@@ -173,26 +173,26 @@ func TestDeleteColumn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteTable(t *testing.T) {
|
||||
func TestPgDeleteTable(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
db.Table("test").DeleteTable()
|
||||
|
||||
}
|
||||
|
||||
func TestImportSchema(t *testing.T) {
|
||||
func TestPgImportSchema(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
db.ImportSchema("pfn.json")
|
||||
}
|
||||
|
||||
func TestClearImportSchema(t *testing.T) {
|
||||
func TestPgClearImportSchema(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
db.ClearImportSchema("pfn.json")
|
||||
}
|
||||
|
||||
func TestGetSchema(t *testing.T) {
|
||||
func TestPgGetSchema(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
data, err := db.GetSchema()
|
||||
@@ -203,7 +203,7 @@ func TestGetSchema(t *testing.T) {
|
||||
fmt.Println(string(val))
|
||||
}
|
||||
|
||||
func TestSaveSchema(t *testing.T) {
|
||||
func TestPgSaveSchema(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
err := db.SaveSchema("schema.json")
|
||||
@@ -211,7 +211,7 @@ func TestSaveSchema(t *testing.T) {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}
|
||||
func TestGenerateTemplate(t *testing.T) {
|
||||
func TestPgGenerateTemplate(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
err := db.GenerateTemplate("plantuml.tmpl", "schema.puml")
|
||||
@@ -220,7 +220,7 @@ func TestGenerateTemplate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateTableTemplate(t *testing.T) {
|
||||
func TestPgGenerateTableTemplate(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
err := db.GenerateTableTemplates("table.tmpl", "gen", "html")
|
||||
|
||||
Reference in New Issue
Block a user