Skip to content

Commit

Permalink
Merge pull request #154 from mailru/chhttp
Browse files Browse the repository at this point in the history
change driver registration name to chhttp
  • Loading branch information
DoubleDi authored Mar 27, 2022
2 parents 88ac256 + 561498d commit 371b656
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Notes:
* for passing decimal value please use the wrappers `clickhouse.Decimal*`
* for passing IPv4/IPv6 types use `clickhouse.IP`
* for passing Tuple types use `clickhouse.Tuple` or structs
* for passing Map types use `clickhouse.Map`

## Supported request params

Expand All @@ -73,7 +74,7 @@ See `Example` section for use cases.

## Install
```
go get -u github.com/mailru/go-clickhouse
go get -u github.com/mailru/go-clickhouse/v2
```

## Example
Expand All @@ -86,11 +87,11 @@ import (
"log"
"time"

"github.com/mailru/go-clickhouse"
"github.com/mailru/go-clickhouse/v2"
)

func main() {
connect, err := sql.Open("clickhouse", "http://127.0.0.1:8123/default")
connect, err := sql.Open("chhttp", "http://127.0.0.1:8123/default")
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -236,12 +237,12 @@ import (
"log"
"time"

_ "github.com/mailru/go-clickhouse"
_ "github.com/mailru/go-clickhouse/v2"
"github.com/mailru/dbr"
)

func main() {
connect, err := dbr.Open("clickhouse", "http://127.0.0.1:8123/default", nil)
connect, err := dbr.Open("chhttp", "http://127.0.0.1:8123/default", nil)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func init() {
sql.Register("clickhouse", new(chDriver))
sql.Register("chhttp", new(chDriver))
}

// chDriver implements sql.Driver interface
Expand Down
6 changes: 3 additions & 3 deletions clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ func (s *chSuite) SetupSuite() {
dsn = "http://localhost:8123/default"
}

conn, err := sql.Open("clickhouse", dsn)
conn, err := sql.Open("chhttp", dsn)
s.Require().NoError(err)
s.Require().NoError(initialzer.Do(conn))
s.conn = conn

connWithCompression, err := sql.Open("clickhouse", dsn+"?enable_http_compression=1")
connWithCompression, err := sql.Open("chhttp", dsn+"?enable_http_compression=1")
s.Require().NoError(err)
s.connWithCompression = connWithCompression

connWithKillQuery, err := sql.Open("clickhouse", dsn+"?kill_query=1&read_timeout=1s")
connWithKillQuery, err := sql.Open("chhttp", dsn+"?kill_query=1&read_timeout=1s")
s.Require().NoError(err)
s.connWithKillQuery = connWithKillQuery
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/mailru/go-clickhouse
module github.com/mailru/go-clickhouse/v2

require (
github.com/google/uuid v1.2.0
Expand Down

0 comments on commit 371b656

Please sign in to comment.