-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
31 lines (27 loc) · 789 Bytes
/
Copy pathmain_test.go
File metadata and controls
31 lines (27 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package autoprepare
import (
"flag"
"os"
"testing"
)
var (
SqliteDSN = flag.String("sqlite", "file::memory:?mode=memory&cache=shared", "SQLite3 DSN")
MysqlDSN = flag.String("mysql", "", "MySQL DSN")
BenchDriver = flag.String("benchdriver", "sqlite3", "database/sql driver to use for benchmarking (sqlite3 or mysql)")
BenchCompare = flag.Bool("benchcompare", true, "Run benchmarks to compare performance of not using autoprepare")
BenchParallel = flag.Bool("benchparallel", true, "Run the parallel benchmarks")
)
func BenchDB() (string, string) {
switch *BenchDriver {
case "sqlite3":
return "sqlite3", *SqliteDSN
case "mysql":
return "mysql", *MysqlDSN
default:
panic("unknown driver")
}
}
func TestMain(m *testing.M) {
flag.Parse()
os.Exit(m.Run())
}