Skip to content

Commit bced2c6

Browse files
authored
Merge branch 'main' into ignore-mat-alias-cols
2 parents 903a0d1 + e47930a commit bced2c6

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

conn_http.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"database/sql/driver"
2727
"fmt"
2828
"io"
29-
"io/ioutil"
3029
"log"
3130
"mime/multipart"
3231
"net"
@@ -86,7 +85,7 @@ func (rw HTTPReaderWriter) read(res *http.Response) ([]byte, error) {
8685
if err := reader.Reset(res.Body); err != nil {
8786
return nil, err
8887
}
89-
body, err := ioutil.ReadAll(reader)
88+
body, err := io.ReadAll(reader)
9089
if err != nil {
9190
return nil, err
9291
}
@@ -97,7 +96,7 @@ func (rw HTTPReaderWriter) read(res *http.Response) ([]byte, error) {
9796
if err := rw.reader.(flate.Resetter).Reset(res.Body, nil); err != nil {
9897
return nil, err
9998
}
100-
body, err := ioutil.ReadAll(reader)
99+
body, err := io.ReadAll(reader)
101100
if err != nil {
102101
return nil, err
103102
}
@@ -107,14 +106,14 @@ func (rw HTTPReaderWriter) read(res *http.Response) ([]byte, error) {
107106
if err := reader.Reset(res.Body); err != nil {
108107
return nil, err
109108
}
110-
body, err := ioutil.ReadAll(reader)
109+
body, err := io.ReadAll(reader)
111110
if err != nil {
112111
return nil, err
113112
}
114113
return body, nil
115114
}
116115
}
117-
body, err := ioutil.ReadAll(res.Body)
116+
body, err := io.ReadAll(res.Body)
118117
if err != nil {
119118
return nil, err
120119
}

conn_http_async_insert.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package clickhouse
2020
import (
2121
"context"
2222
"io"
23-
"io/ioutil"
2423
)
2524

2625
func (h *httpConnect) asyncInsert(ctx context.Context, query string, wait bool, args ...any) error {
@@ -43,7 +42,7 @@ func (h *httpConnect) asyncInsert(ctx context.Context, query string, wait bool,
4342
if res != nil {
4443
defer res.Body.Close()
4544
// we don't care about result, so just discard it to reuse connection
46-
_, _ = io.Copy(ioutil.Discard, res.Body)
45+
_, _ = io.Copy(io.Discard, res.Body)
4746
}
4847

4948
return err

conn_http_batch.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"errors"
2323
"fmt"
2424
"io"
25-
"io/ioutil"
2625
"regexp"
2726
"strings"
2827

@@ -73,10 +72,11 @@ func (h *httpConnect) prepareBatch(ctx context.Context, query string, opts drive
7372
if err = r.Scan(&colName, &colType, &default_type, &ignore, &ignore, &ignore, &ignore); err != nil {
7473
return nil, err
7574
}
76-
// // these column types cannot be specified in INSERT queries
77-
// if default_type == "MATERIALIZED" || default_type == "ALIAS" {
78-
// continue
79-
// }
75+
// these column types cannot be specified in INSERT queries
76+
77+
if default_type == "MATERIALIZED" || default_type == "ALIAS" {
78+
continue
79+
}
8080
colNames = append(colNames, colName)
8181
columns[colName] = colType
8282
}
@@ -230,7 +230,7 @@ func (b *httpBatch) Send() (err error) {
230230
if res != nil {
231231
defer res.Body.Close()
232232
// we don't care about result, so just discard it to reuse connection
233-
_, _ = io.Copy(ioutil.Discard, res.Body)
233+
_, _ = io.Copy(io.Discard, res.Body)
234234
}
235235

236236
return err

conn_http_exec.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package clickhouse
2020
import (
2121
"context"
2222
"io"
23-
"io/ioutil"
2423
)
2524

2625
func (h *httpConnect) exec(ctx context.Context, query string, args ...any) error {
@@ -34,7 +33,7 @@ func (h *httpConnect) exec(ctx context.Context, query string, args ...any) error
3433
if res != nil {
3534
defer res.Body.Close()
3635
// we don't care about result, so just discard it to reuse connection
37-
_, _ = io.Copy(ioutil.Discard, res.Body)
36+
_, _ = io.Copy(io.Discard, res.Body)
3837
}
3938

4039
return err

examples/clickhouse_api/ssl.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121
"crypto/tls"
2222
"crypto/x509"
2323
"fmt"
24-
"github.com/ClickHouse/clickhouse-go/v2"
25-
"io/ioutil"
2624
"os"
2725
"path"
26+
27+
"github.com/ClickHouse/clickhouse-go/v2"
2828
)
2929

3030
func SSLVersion() error {
@@ -37,7 +37,7 @@ func SSLVersion() error {
3737
return err
3838
}
3939
t := &tls.Config{}
40-
caCert, err := ioutil.ReadFile(path.Join(cwd, "../../tests/resources/CAroot.crt"))
40+
caCert, err := os.ReadFile(path.Join(cwd, "../../tests/resources/CAroot.crt"))
4141
if err != nil {
4242
return err
4343
}

examples/std/ssl.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"crypto/x509"
2323
"database/sql"
2424
"fmt"
25-
"github.com/ClickHouse/clickhouse-go/v2"
26-
"io/ioutil"
2725
"os"
2826
"path"
27+
28+
"github.com/ClickHouse/clickhouse-go/v2"
2929
)
3030

3131
func ConnectSSL() error {
@@ -38,7 +38,7 @@ func ConnectSSL() error {
3838
return err
3939
}
4040
t := &tls.Config{}
41-
caCert, err := ioutil.ReadFile(path.Join(cwd, "../../tests/resources/CAroot.crt"))
41+
caCert, err := os.ReadFile(path.Join(cwd, "../../tests/resources/CAroot.crt"))
4242
if err != nil {
4343
return err
4444
}

0 commit comments

Comments
 (0)