Skip to content

Commit 1e2cca3

Browse files
committed
* Added system certificates for darwin system
* Fixed `table.StreamResult` finishing * Fixes `sugar.MakePath()` * Added helper `ydb.MergeOptions()` for merge several `ydb.Option` to single `ydb.Option`
1 parent f1e959a commit 1e2cca3

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.5.1
2+
* Added system certificates for `darwin` system
3+
* Fixed `table.StreamResult` finishing
4+
* Fixes `sugar.MakePath()`
5+
* Added helper `ydb.MergeOptions()` for merge several `ydb.Option` to single `ydb.Option`
6+
17
## 3.5.0
28
* Added `ClosabelSession` interface which extends `Session` interface and provide `Close` method
39
* Added `CreateSession` method into `table.Client` interface

config/config.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package config
33
import (
44
"crypto/tls"
55
"crypto/x509"
6-
"runtime"
76
"time"
87

98
"google.golang.org/grpc"
@@ -288,12 +287,8 @@ func defaults() (c *config) {
288287
certPool *x509.CertPool
289288
err error
290289
)
291-
if runtime.GOOS != "darwin" {
292-
certPool, err = x509.SystemCertPool()
293-
if err != nil {
294-
certPool = x509.NewCertPool()
295-
}
296-
} else {
290+
certPool, err = x509.SystemCertPool()
291+
if err != nil {
297292
certPool = x509.NewCertPool()
298293
}
299294
return &config{

internal/meta/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package meta
22

33
const (
4-
Version = "ydb-go-sdk/3.5.0"
4+
Version = "ydb-go-sdk/3.5.1"
55
)

internal/table/scanner/result.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (r *streamResult) NextResultSet(ctx context.Context, columns ...string) boo
122122
}
123123
select {
124124
case s, ok := <-r.ch:
125-
if !ok {
125+
if !ok || s == nil {
126126
return false
127127
}
128128
r.Reset(s, columns...)

internal/table/session.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ func (s *session) StreamReadTable(ctx context.Context, path string, opts ...opti
699699
defer func() {
700700
cancel()
701701
onDone(r, errors.HideEOF(err))
702+
r.Append(nil)
702703
}()
703704
for {
704705
select {
@@ -765,6 +766,7 @@ func (s *session) StreamExecuteScanQuery(ctx context.Context, query string, para
765766
defer func() {
766767
cancel()
767768
onDone(r, errors.HideEOF(err))
769+
r.Append(nil)
768770
}()
769771
for {
770772
select {

options.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ func With(options ...config.Option) Option {
149149
}
150150
}
151151

152+
func MergeOptions(options ...Option) Option {
153+
return func(ctx context.Context, db *db) error {
154+
for _, o := range options {
155+
if err := o(ctx, db); err != nil {
156+
return err
157+
}
158+
}
159+
return nil
160+
}
161+
}
162+
152163
func WithDiscoveryInterval(discoveryInterval time.Duration) Option {
153164
return func(ctx context.Context, db *db) error {
154165
db.options = append(db.options, config.WithDiscoveryInterval(discoveryInterval))

sugar/sugar.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ import (
1414

1515
// MakePath creates path inside database
1616
func MakePath(ctx context.Context, db ydb.Connection, path string) error {
17-
for i := 0; i < len(path); i++ {
17+
for i := len(db.Name()) + 1; i < len(path); i++ {
1818
x := strings.IndexByte(path[i:], '/')
1919
if x == -1 {
2020
x = len(path[i:]) - 1
2121
}
2222
i += x
2323
sub := path[:i+1]
2424
info, err := db.Scheme().DescribePath(ctx, sub)
25-
operr, ok := err.(*errors.OpError)
26-
if ok && operr.Reason == errors.StatusSchemeError {
25+
opErr, ok := err.(*errors.OpError)
26+
if ok && opErr.Reason == errors.StatusSchemeError {
2727
err = db.Scheme().MakeDirectory(ctx, sub)
2828
}
2929
if err != nil {

0 commit comments

Comments
 (0)