Skip to content

Commit 3e3a2cf

Browse files
author
Roman Golov
committed
Merge remote-tracking branch 'origin/master' into HEAD
2 parents af70b2c + fe6b521 commit 3e3a2cf

File tree

36 files changed

+1811
-1715
lines changed

36 files changed

+1811
-1715
lines changed

.github/workflows/check-codegen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Build
3333
run: |
3434
go install ./internal/cmd/gtrace
35-
go install go.uber.org/mock/mockgen@892b665398ecece7c7a900d2a2f2fa3dac07e4c4
35+
go install go.uber.org/mock/mockgen@v0.4.0
3636
3737
- name: Clean and re-generate *_gtrace.go files
3838
run: |

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
fail-fast: false
4646
matrix:
4747
go-version: [1.21.x, 1.22.x]
48-
ydb-version: [22.5, 23.1, 23.2, 23.3]
48+
ydb-version: [22.5, 23.1, 23.2, 23.3, 24.1]
4949
services:
5050
ydb:
5151
image: cr.yandex/yc/yandex-docker-local-ydb:${{ matrix.ydb-version }}

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ linters-settings:
112112
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
113113
# with golangci-lint call it on a directory with the changed file.
114114
check-exported: false
115+
gomoddirectives:
116+
replace-local: true
117+
replace-allow-list:
118+
- xorm.io/xorm
115119
gocritic:
116120
disabled-checks:
117121
- whyNoLint # https://github.com/go-critic/go-critic/issues/1063
@@ -232,7 +236,6 @@ linters:
232236
- goerr113
233237
- golint
234238
- gomnd
235-
- gomoddirectives
236239
- ifshort
237240
- interfacebloat
238241
- ireturn

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v3.56.2
2+
* Fixed return private error for commit to stopped partition in topic reader.
3+
* Stopped wrapping err error as transport error at topic streams (internals)
4+
15
## v3.56.1
26
* Fixed fixenv usage (related to tests only)
37

internal/decimal/type.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package decimal
2+
3+
import "math/big"
4+
5+
type Decimal struct {
6+
Bytes [16]byte
7+
Precision uint32
8+
Scale uint32
9+
}
10+
11+
func (d *Decimal) String() string {
12+
v := FromInt128(d.Bytes, d.Precision, d.Scale)
13+
14+
return Format(v, d.Precision, d.Scale)
15+
}
16+
17+
func (d *Decimal) BigInt() *big.Int {
18+
return FromInt128(d.Bytes, d.Precision, d.Scale)
19+
}

internal/discovery/discovery.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ func (c *Client) Discover(ctx context.Context) (endpoints []endpoint.Endpoint, e
7070

7171
if response.GetOperation().GetStatus() != Ydb.StatusIds_SUCCESS {
7272
return nil, xerrors.WithStackTrace(
73-
xerrors.Operation(
74-
xerrors.FromOperation(response.GetOperation()),
75-
),
73+
xerrors.FromOperation(response.GetOperation()),
7674
)
7775
}
7876

@@ -126,10 +124,8 @@ func (c *Client) WhoAmI(ctx context.Context) (whoAmI *discovery.WhoAmI, err erro
126124

127125
if response.GetOperation().GetStatus() != Ydb.StatusIds_SUCCESS {
128126
return nil, xerrors.WithStackTrace(
129-
xerrors.Operation(
130-
xerrors.FromOperation(
131-
response.GetOperation(),
132-
),
127+
xerrors.FromOperation(
128+
response.GetOperation(),
133129
),
134130
)
135131
}

internal/grpcwrapper/rawtopic/rawtopicreader/rawtopicreader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package rawtopicreader
33
import (
44
"errors"
55
"fmt"
6+
"io"
67
"reflect"
78

89
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Topic"
@@ -30,6 +31,9 @@ func (s StreamReader) CloseSend() error {
3031

3132
func (s StreamReader) Recv() (ServerMessage, error) {
3233
grpcMess, err := s.Stream.Recv()
34+
if xerrors.Is(err, io.EOF) {
35+
return nil, err
36+
}
3337
if err != nil {
3438
if !xerrors.IsErrorFromServer(err) {
3539
err = xerrors.Transport(err)

internal/operation/status.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package operation
2+
3+
import (
4+
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
5+
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Issue"
6+
)
7+
8+
type Status interface {
9+
GetStatus() Ydb.StatusIds_StatusCode
10+
GetIssues() []*Ydb_Issue.IssueMessage
11+
}

internal/scanner/scanner.go

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
package scanner
2+
3+
import (
4+
"io"
5+
"time"
6+
7+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/decimal"
8+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/types"
9+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
10+
)
11+
12+
// RawValue scanning non-primitive yql types or for own implementation scanner native API
13+
type RawValue interface {
14+
Path() string
15+
WritePathTo(w io.Writer) (n int64, err error)
16+
Type() types.Type
17+
Bool() (v bool)
18+
Int8() (v int8)
19+
Uint8() (v uint8)
20+
Int16() (v int16)
21+
Uint16() (v uint16)
22+
Int32() (v int32)
23+
Uint32() (v uint32)
24+
Int64() (v int64)
25+
Uint64() (v uint64)
26+
Float() (v float32)
27+
Double() (v float64)
28+
Date() (v time.Time)
29+
Datetime() (v time.Time)
30+
Timestamp() (v time.Time)
31+
Interval() (v time.Duration)
32+
TzDate() (v time.Time)
33+
TzDatetime() (v time.Time)
34+
TzTimestamp() (v time.Time)
35+
String() (v []byte)
36+
UTF8() (v string)
37+
YSON() (v []byte)
38+
JSON() (v []byte)
39+
UUID() (v [16]byte)
40+
JSONDocument() (v []byte)
41+
DyNumber() (v string)
42+
Value() value.Value
43+
44+
// Any returns any primitive or optional value.
45+
// Currently, it may return one of these types:
46+
//
47+
// bool
48+
// int8
49+
// uint8
50+
// int16
51+
// uint16
52+
// int32
53+
// uint32
54+
// int64
55+
// uint64
56+
// float32
57+
// float64
58+
// []byte
59+
// string
60+
// [16]byte
61+
//
62+
Any() interface{}
63+
64+
// Unwrap unwraps current item under scan interpreting it as Optional<Type> types.
65+
Unwrap()
66+
AssertType(t types.Type) bool
67+
IsNull() bool
68+
IsOptional() bool
69+
70+
// ListIn interprets current item under scan as a ydb's list.
71+
// It returns the size of the nested items.
72+
// If current item under scan is not a list types, it returns -1.
73+
ListIn() (size int)
74+
75+
// ListItem selects current item i-th element as an item to scan.
76+
// ListIn() must be called before.
77+
ListItem(i int)
78+
79+
// ListOut leaves list entered before by ListIn() call.
80+
ListOut()
81+
82+
// TupleIn interprets current item under scan as a ydb's tuple.
83+
// It returns the size of the nested items.
84+
TupleIn() (size int)
85+
86+
// TupleItem selects current item i-th element as an item to scan.
87+
// Note that TupleIn() must be called before.
88+
// It panics if it is out of bounds.
89+
TupleItem(i int)
90+
91+
// TupleOut leaves tuple entered before by TupleIn() call.
92+
TupleOut()
93+
94+
// StructIn interprets current item under scan as a ydb's struct.
95+
// It returns the size of the nested items – the struct fields values.
96+
// If there is no current item under scan it returns -1.
97+
StructIn() (size int)
98+
99+
// StructField selects current item i-th field value as an item to scan.
100+
// Note that StructIn() must be called before.
101+
// It panics if i is out of bounds.
102+
StructField(i int) (name string)
103+
104+
// StructOut leaves struct entered before by StructIn() call.
105+
StructOut()
106+
107+
// DictIn interprets current item under scan as a ydb's dict.
108+
// It returns the size of the nested items pairs.
109+
// If there is no current item under scan it returns -1.
110+
DictIn() (size int)
111+
112+
// DictKey selects current item i-th pair key as an item to scan.
113+
// Note that DictIn() must be called before.
114+
// It panics if i is out of bounds.
115+
DictKey(i int)
116+
117+
// DictPayload selects current item i-th pair value as an item to scan.
118+
// Note that DictIn() must be called before.
119+
// It panics if i is out of bounds.
120+
DictPayload(i int)
121+
122+
// DictOut leaves dict entered before by DictIn() call.
123+
DictOut()
124+
125+
// Variant unwraps current item under scan interpreting it as Variant<Type> types.
126+
// It returns non-empty name of a field that is filled for struct-based
127+
// variant.
128+
// It always returns an index of filled field of a Type.
129+
Variant() (name string, index uint32)
130+
131+
// Decimal returns decimal value represented by big-endian 128 bit signed integer.
132+
Decimal(t types.Type) (v [16]byte)
133+
134+
// UnwrapDecimal returns decimal value represented by big-endian 128 bit signed
135+
// integer and its types information.
136+
UnwrapDecimal() decimal.Decimal
137+
IsDecimal() bool
138+
Err() error
139+
}
140+
141+
// Scanner scanning raw ydb types
142+
type Scanner interface {
143+
// UnmarshalYDB must be implemented on client-side for unmarshal raw ydb value.
144+
UnmarshalYDB(raw RawValue) error
145+
}

internal/scripting/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ import (
1515
"github.com/ydb-platform/ydb-go-sdk/v3/internal/scripting/config"
1616
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
1717
"github.com/ydb-platform/ydb-go-sdk/v3/internal/table/scanner"
18-
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
18+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/types"
1919
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
2020
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
2121
"github.com/ydb-platform/ydb-go-sdk/v3/retry"
2222
"github.com/ydb-platform/ydb-go-sdk/v3/scripting"
2323
"github.com/ydb-platform/ydb-go-sdk/v3/table"
2424
"github.com/ydb-platform/ydb-go-sdk/v3/table/result"
25-
"github.com/ydb-platform/ydb-go-sdk/v3/table/types"
2625
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
2726
)
2827

@@ -184,7 +183,7 @@ func (c *Client) explain(
184183
ParameterTypes: make(map[string]types.Type, len(result.GetParametersTypes())),
185184
}
186185
for k, v := range result.GetParametersTypes() {
187-
e.ParameterTypes[k] = value.TypeFromYDB(v)
186+
e.ParameterTypes[k] = types.TypeFromYDB(v)
188187
}
189188

190189
return e, nil

0 commit comments

Comments
 (0)