MCPcopy
hub / github.com/jmoiron/sqlx / ConnectAll

Function ConnectAll

sqlx_test.go:49–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47}
48
49func ConnectAll() {
50 var err error
51
52 pgdsn := os.Getenv("SQLX_POSTGRES_DSN")
53 mydsn := os.Getenv("SQLX_MYSQL_DSN")
54 sqdsn := os.Getenv("SQLX_SQLITE_DSN")
55
56 TestPostgres = pgdsn != "skip"
57 TestMysql = mydsn != "skip"
58 TestSqlite = sqdsn != "skip"
59
60 if !strings.Contains(mydsn, "parseTime=true") {
61 mydsn += "?parseTime=true"
62 }
63
64 if TestPostgres {
65 pgdb, err = Connect("postgres", pgdsn)
66 if err != nil {
67 fmt.Printf("Disabling PG tests:\n %v\n", err)
68 TestPostgres = false
69 }
70 } else {
71 fmt.Println("Disabling Postgres tests.")
72 }
73
74 if TestMysql {
75 mysqldb, err = Connect("mysql", mydsn)
76 if err != nil {
77 fmt.Printf("Disabling MySQL tests:\n %v", err)
78 TestMysql = false
79 }
80 } else {
81 fmt.Println("Disabling MySQL tests.")
82 }
83
84 if TestSqlite {
85 sldb, err = Connect("sqlite3", sqdsn)
86 if err != nil {
87 fmt.Printf("Disabling SQLite:\n %v", err)
88 TestSqlite = false
89 }
90 } else {
91 fmt.Println("Disabling SQLite tests.")
92 }
93}
94
95type Schema struct {
96 create string

Callers 1

initFunction · 0.85

Calls 1

ConnectFunction · 0.85

Tested by

no test coverage detected