Skip to content

Commit

Permalink
feat: add options with Open connection
Browse files Browse the repository at this point in the history
  • Loading branch information
fifsky committed Jun 29, 2022
1 parent af36052 commit b27d4a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ func TestMain(m *testing.M) {
}

func TestWithOptions(t *testing.T) {
_, err := Open("mysql", "root:123456@tcp(127.0.0.1:3306)/test?charset=utf8&parseTime=True&loc=Asia%2FShanghai", WithMaxOpenConns(10), WithMaxIdleConns(100), WithMaxLifetimes(100))
dsn := os.Getenv("MYSQL_TEST_DSN2")

if dsn == "" {
dsn = "root:123456@tcp(127.0.0.1:3306)/test2?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
}

_, err := Open("mysql", dsn, WithMaxOpenConns(10), WithMaxIdleConns(100), WithMaxLifetimes(100))
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit b27d4a3

Please sign in to comment.