Skip to content

Commit 27ac809

Browse files
sql/ydb: fixed linter
1 parent b296240 commit 27ac809

File tree

7 files changed

+22
-25
lines changed

7 files changed

+22
-25
lines changed

go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
105105
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
106106
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
107107
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
108-
github.com/ydb-platform/ydb-go-genproto v0.0.0-20251125145508-6d7ef87db5cb h1:LZ6dhVfWzhicf/P5Xh7fA0Jd7rfGduxmB2QZpD+Lz9Q=
109-
github.com/ydb-platform/ydb-go-genproto v0.0.0-20251125145508-6d7ef87db5cb/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I=
110108
github.com/ydb-platform/ydb-go-genproto v0.0.0-20251222105147-0bf751469a4a h1:nRqONRrMFulP2bTWM2RRnPM1VDhWuBZg4ULXkG4xXdk=
111109
github.com/ydb-platform/ydb-go-genproto v0.0.0-20251222105147-0bf751469a4a/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I=
112-
github.com/ydb-platform/ydb-go-sdk/v3 v3.123.0 h1:VwaqDpAbNJ+PvPV7meiCuUptsqLhPkHq5tMYu45BrX8=
113-
github.com/ydb-platform/ydb-go-sdk/v3 v3.123.0/go.mod h1:/LjMxb/rXmoGAAnImoqAFIlhO5ampHacbvDetQitCk4=
114110
github.com/ydb-platform/ydb-go-sdk/v3 v3.125.0 h1:KPnGV2diuX1A4/1zXLO1UWHJokWC8yICzEfjdkSUWKo=
115111
github.com/ydb-platform/ydb-go-sdk/v3 v3.125.0/go.mod h1:/LjMxb/rXmoGAAnImoqAFIlhO5ampHacbvDetQitCk4=
116112
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
@@ -187,8 +183,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
187183
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
188184
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
189185
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
190-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 h1:2I6GHUeJ/4shcDpoUlLs/2WPnhg7yJwvXtqcMJt9liA=
191-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
192186
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b h1:Mv8VFug0MP9e5vUxfBcE3vUkV6CImK3cMNMIDFjmzxU=
193187
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
194188
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@@ -198,8 +192,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
198192
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
199193
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
200194
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
201-
google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM=
202-
google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig=
203195
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
204196
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
205197
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=

sql/ydb/convert.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func FormatType(typ schema.Type) (string, error) {
4444
case YsonType:
4545
formatted = t.T
4646
case *schema.UUIDType:
47-
formatted = TypeUuid
47+
formatted = TypeUUID
4848
case *schema.TimeType:
4949
formatted, err = formatTimeType(t)
5050
case *schema.UnsupportedType:
@@ -113,7 +113,7 @@ func formatDecimalType(t *schema.DecimalType) (string, error) {
113113
func formatJSONType(t *schema.JSONType) (string, error) {
114114
typ := strings.ToLower(t.T)
115115
switch typ {
116-
case TypeJsonDocument, TypeJson:
116+
case TypeJSONDocument, TypeJSON:
117117
return typ, nil
118118
default:
119119
return "", fmt.Errorf("ydb: unsupported object identifier type: %q", t.T)
@@ -284,11 +284,11 @@ func columnType(colDesc *columnDecscriptor) (schema.Type, error) {
284284
typ = &schema.BinaryType{T: strT}
285285
case TypeUtf8:
286286
typ = &schema.StringType{T: strT}
287-
case TypeJson, TypeJsonDocument:
287+
case TypeJSON, TypeJSONDocument:
288288
typ = &schema.JSONType{T: strT}
289289
case TypeYson:
290290
typ = &YsonType{T: strT}
291-
case TypeUuid:
291+
case TypeUUID:
292292
typ = &schema.UUIDType{T: strT}
293293
case TypeDate,
294294
TypeDate32,

sql/ydb/convert_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ func TestConvert_FormatType(t *testing.T) {
6565
{name: "utf8", typ: &schema.StringType{T: TypeUtf8}, expected: TypeUtf8},
6666

6767
// JSON types
68-
{name: "json", typ: &schema.JSONType{T: TypeJson}, expected: TypeJson},
69-
{name: "jsondocument", typ: &schema.JSONType{T: TypeJsonDocument}, expected: TypeJsonDocument},
68+
{name: "json", typ: &schema.JSONType{T: TypeJSON}, expected: TypeJSON},
69+
{name: "jsondocument", typ: &schema.JSONType{T: TypeJSONDocument}, expected: TypeJSONDocument},
7070

7171
// YSON type
7272
{name: "yson", typ: YsonType{T: TypeYson}, expected: TypeYson},
7373

7474
// UUID type
75-
{name: "uuid", typ: &schema.UUIDType{T: TypeUuid}, expected: TypeUuid},
75+
{name: "uuid", typ: &schema.UUIDType{T: TypeUUID}, expected: TypeUUID},
7676

7777
// Date/Time types
7878
{name: "date", typ: &schema.TimeType{T: TypeDate}, expected: TypeDate},
@@ -160,14 +160,14 @@ func TestConvert_ParseType(t *testing.T) {
160160
{name: "utf8", input: TypeUtf8, expected: &schema.StringType{T: TypeUtf8}},
161161

162162
// JSON types
163-
{name: "json", input: TypeJson, expected: &schema.JSONType{T: TypeJson}},
164-
{name: "jsonDocument", input: TypeJsonDocument, expected: &schema.JSONType{T: TypeJsonDocument}},
163+
{name: "json", input: TypeJSON, expected: &schema.JSONType{T: TypeJSON}},
164+
{name: "jsonDocument", input: TypeJSONDocument, expected: &schema.JSONType{T: TypeJSONDocument}},
165165

166166
// YSON type
167167
{name: "yson", input: TypeYson, expected: &YsonType{T: TypeYson}},
168168

169169
// UUID type
170-
{name: "uuid", input: TypeUuid, expected: &schema.UUIDType{T: TypeUuid}},
170+
{name: "uuid", input: TypeUUID, expected: &schema.UUIDType{T: TypeUUID}},
171171

172172
// Date/Time types
173173
{name: "date", input: TypeDate, expected: &schema.TimeType{T: TypeDate}},

sql/ydb/inspect_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (m *mockSchemeClient) Database() string {
3232
return m.database
3333
}
3434

35-
func (m *mockSchemeClient) ListDirectory(ctx context.Context, path string) (scheme.Directory, error) {
35+
func (m *mockSchemeClient) ListDirectory(_ context.Context, path string) (scheme.Directory, error) {
3636
if m.listDirErr != nil {
3737
return scheme.Directory{}, m.listDirErr
3838
}
@@ -42,7 +42,7 @@ func (m *mockSchemeClient) ListDirectory(ctx context.Context, path string) (sche
4242
return scheme.Directory{}, errors.New("path not found: " + path)
4343
}
4444

45-
func (m *mockSchemeClient) DescribePath(ctx context.Context, path string) (scheme.Entry, error) {
45+
func (m *mockSchemeClient) DescribePath(_ context.Context, path string) (scheme.Entry, error) {
4646
return scheme.Entry{}, nil
4747
}
4848

sql/ydb/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type planApply struct{ *conn }
2626

2727
// PlanChanges returns a migration plan for the given schema changes.
2828
func (p *planApply) PlanChanges(
29-
ctx context.Context,
29+
_ context.Context,
3030
name string,
3131
changes []schema.Change,
3232
opts ...migrate.PlanOption,

sql/ydb/migrate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestPlanChanges_AddTable(t *testing.T) {
151151
schema.NewColumn("flag").SetType(&schema.BoolType{T: TypeBool}),
152152
schema.NewColumn("price").SetType(&schema.DecimalType{T: TypeDecimal, Precision: 10, Scale: 2}),
153153
schema.NewColumn("timestamp").SetType(&schema.TimeType{T: TypeTimestamp}),
154-
schema.NewColumn("data").SetType(&schema.JSONType{T: TypeJson}),
154+
schema.NewColumn("data").SetType(&schema.JSONType{T: TypeJSON}),
155155
)
156156
t.SetPrimaryKey(schema.NewPrimaryKey(t.Columns[0]))
157157
return t

sql/ydb/types.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const (
3737

3838
TypeString = "string"
3939
TypeUtf8 = "utf8"
40-
TypeJson = "json"
41-
TypeJsonDocument = "jsondocument"
40+
TypeJSON = "json"
41+
TypeJSONDocument = "jsondocument"
4242
TypeYson = "yson"
43-
TypeUuid = "uuid"
43+
TypeUUID = "uuid"
4444

4545
TypeDate = "date"
4646
TypeDate32 = "date32"
@@ -60,23 +60,27 @@ const (
6060
)
6161

6262
type (
63+
// OptionalType represents nullable type
6364
OptionalType struct {
6465
schema.Type
6566
T string
6667
InnerType schema.Type
6768
}
6869

70+
// SerialType is used to implement type with auto increment
6971
SerialType struct {
7072
schema.Type
7173
T string
7274
}
7375

76+
// YsonType represents YSON - JSON-like data format
7477
YsonType struct {
7578
schema.Type
7679
T string
7780
}
7881
)
7982

83+
// Converts [SerialType] to corresponding [schema.IntegerType]
8084
func (s *SerialType) IntegerType() *schema.IntegerType {
8185
t := &schema.IntegerType{T: TypeInt64}
8286
switch s.T {
@@ -90,6 +94,7 @@ func (s *SerialType) IntegerType() *schema.IntegerType {
9094
return t
9195
}
9296

97+
// Sets [schema.IntegerType] as base underlying type for [SerialType]
9398
func (s *SerialType) SetType(t *schema.IntegerType) {
9499
switch t.T {
95100
case TypeInt16:

0 commit comments

Comments
 (0)