Skip to content

Commit 68535b9

Browse files
committed
update readme
1 parent e92a54d commit 68535b9

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ClickHouse
1+
# ClickHouse [![Build Status](https://travis-ci.org/kshvakov/clickhouse.svg?branch=master)](https://travis-ci.org/kshvakov/clickhouse) [![Go Report Card](https://goreportcard.com/badge/github.com/kshvakov/clickhouse)](https://goreportcard.com/report/github.com/kshvakov/clickhouse) [![Coverage Status](https://coveralls.io/repos/github/kshvakov/clickhouse/badge.svg?branch=master)](https://coveralls.io/github/kshvakov/clickhouse?branch=master)
22

3-
Golang SQL database driver for [Yandex ClickHouse](https://clickhouse.yandex/) [![Build Status](https://travis-ci.org/kshvakov/clickhouse.svg?branch=master)](https://travis-ci.org/kshvakov/clickhouse) [![Go Report Card](https://goreportcard.com/badge/github.com/kshvakov/clickhouse)](https://goreportcard.com/report/github.com/kshvakov/clickhouse) [![Coverage Status](https://coveralls.io/repos/github/kshvakov/clickhouse/badge.svg?branch=master)](https://coveralls.io/github/kshvakov/clickhouse?branch=master)
3+
Golang SQL database driver for [Yandex ClickHouse](https://clickhouse.yandex/)
44

55
## Key features
66

@@ -10,8 +10,9 @@ Golang SQL database driver for [Yandex ClickHouse](https://clickhouse.yandex/) [
1010

1111
## DSN
1212

13-
* read_timeout/write_timeout - timeout in second
1413
* username/password - auth credentials
14+
* database - select the current default database
15+
* read_timeout/write_timeout - timeout in second
1516
* alt_hosts - comma separated list of single address host for load-balancing
1617
* debug - enable debug output (boolean value)
1718

@@ -31,7 +32,7 @@ Golang SQL database driver for [Yandex ClickHouse](https://clickhouse.yandex/) [
3132

3233
example:
3334
```
34-
tcp://host1:9000?timeout=60&username=user&password=qwerty&alt_hosts=host2:9000,host3:9000
35+
tcp://host1:9000?username=user&password=qwerty&database=clicks&read_timeout=10&write_timeout=20&alt_hosts=host2:9000,host3:9000
3536
```
3637

3738

@@ -54,7 +55,7 @@ import (
5455
)
5556

5657
func main() {
57-
connect, err := sql.Open("clickhouse", "tcp://127.0.0.1:9000?username=&compress=true&debug=true")
58+
connect, err := sql.Open("clickhouse", "tcp://127.0.0.1:9000?debug=true")
5859
if err != nil {
5960
log.Fatal(err)
6061
}

clickhouse_naive_test.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package clickhouse
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func Test_Naive_Result(t *testing.T) {
11+
var result result
12+
if _, err := result.LastInsertId(); assert.Error(t, err) {
13+
if rows, err := result.RowsAffected(); assert.Error(t, err) {
14+
assert.Equal(t, int64(0), rows)
15+
}
16+
}
17+
}
18+
19+
func Test_Naive_Exception(t *testing.T) {
20+
exception := Exception{
21+
Code: 42,
22+
Message: "test",
23+
}
24+
if assert.Implements(t, (*error)(nil), &exception) {
25+
assert.Equal(t, fmt.Sprintf("code: %d, message: %s", exception.Code, exception.Message), exception.Error())
26+
}
27+
}

result.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package clickhouse
22

3+
import "errors"
4+
35
type result struct{}
46

5-
func (*result) LastInsertId() (int64, error) { return 0, nil }
6-
func (*result) RowsAffected() (int64, error) { return 0, nil }
7+
func (*result) LastInsertId() (int64, error) { return 0, errors.New("LastInsertId is not supported") }
8+
func (*result) RowsAffected() (int64, error) { return 0, errors.New("RowsAffected is not supported") }

0 commit comments

Comments
 (0)