Skip to content

Commit 28e7327

Browse files
authored
Merge pull request #1525 from ydb-platform/uuid-fix-break
uuid-fix-break
2 parents 8e1c411 + 30a789e commit 28e7327

18 files changed

+99
-256
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Removed UUID methods from ydb.ParamsBuilder()
2+
13
## v3.87.0
24
* BREAK OLD STYLE WORK WITH UUID. See https://github.com/ydb-platform/ydb-go-sdk/issues/1501 for details.
35
At the version you must explicit choose way for work with uuid: old with bug or new (fixed).

internal/params/dict.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,18 @@ func (d *dictValue) YSON(v []byte) *dict {
444444
return d.pair.parent
445445
}
446446

447-
// UUID has data corruption bug and will be removed in next version.
447+
//// UUID has data corruption bug and will be removed in next version.
448+
////
449+
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
450+
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
451+
//func (d *dictValue) UUID(v [16]byte) *dict {
452+
// d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{
453+
// K: d.pair.keyValue,
454+
// V: value.UUIDWithIssue1501Value(v),
455+
// })
448456
//
449-
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
450-
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
451-
func (d *dictValue) UUID(v [16]byte) *dict {
452-
d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{
453-
K: d.pair.keyValue,
454-
V: value.UUIDWithIssue1501Value(v),
455-
})
456-
457-
return d.pair.parent
458-
}
457+
// return d.pair.parent
458+
//}
459459

460460
func (d *dictValue) Uuid(v uuid.UUID) *dict { //nolint:revive,stylecheck
461461
d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{

internal/params/dict_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -347,22 +347,6 @@ func TestDict(t *testing.T) {
347347
},
348348
},
349349
},
350-
{
351-
method: "UUID",
352-
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
353-
354-
expected: expected{
355-
Type: &Ydb.Type{
356-
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
357-
},
358-
Value: &Ydb.Value{
359-
Value: &Ydb.Value_Low_128{
360-
Low_128: 651345242494996240,
361-
},
362-
High_128: 72623859790382856,
363-
},
364-
},
365-
},
366350
{
367351
method: "Uuid",
368352
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

internal/params/list.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ func (l *listItem) YSON(v []byte) *list {
167167
return l.parent
168168
}
169169

170-
// UUID has data corruption bug and will be removed in next version.
170+
//// UUID has data corruption bug and will be removed in next version.
171+
////
172+
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
173+
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
174+
//func (l *listItem) UUID(v [16]byte) *list {
175+
// l.parent.values = append(l.parent.values, value.UUIDWithIssue1501Value(v))
171176
//
172-
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
173-
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
174-
func (l *listItem) UUID(v [16]byte) *list {
175-
l.parent.values = append(l.parent.values, value.UUIDWithIssue1501Value(v))
176-
177-
return l.parent
178-
}
177+
// return l.parent
178+
//}
179179

180180
func (l *listItem) Uuid(v uuid.UUID) *list { //nolint:revive,stylecheck
181181
l.parent.values = append(l.parent.values, value.Uuid(v))

internal/params/list_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -346,22 +346,6 @@ func TestList(t *testing.T) {
346346
},
347347
},
348348
},
349-
{
350-
method: "UUID",
351-
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
352-
353-
expected: expected{
354-
Type: &Ydb.Type{
355-
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
356-
},
357-
Value: &Ydb.Value{
358-
Value: &Ydb.Value_Low_128{
359-
Low_128: 651345242494996240,
360-
},
361-
High_128: 72623859790382856,
362-
},
363-
},
364-
},
365349
{
366350
method: "Uuid",
367351
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

internal/params/optional.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ func (p *optional) YSON(v *[]byte) *optionalBuilder {
155155
return &optionalBuilder{opt: p}
156156
}
157157

158-
// UUID has data corruption bug and will be removed in next version.
158+
//// UUID has data corruption bug and will be removed in next version.
159+
////
160+
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
161+
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
162+
//func (p *optional) UUID(v *[16]byte) *optionalBuilder {
163+
// p.value = value.NullableUUIDValue(v)
159164
//
160-
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
161-
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
162-
func (p *optional) UUID(v *[16]byte) *optionalBuilder {
163-
p.value = value.NullableUUIDValue(v)
164-
165-
return &optionalBuilder{opt: p}
166-
}
165+
// return &optionalBuilder{opt: p}
166+
//}
167167

168168
func (p *optional) Uuid(v *uuid.UUID) *optionalBuilder { //nolint:revive,stylecheck
169169
p.value = value.NullableUuidValue(v)

internal/params/optional_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -555,32 +555,6 @@ func TestOptional(t *testing.T) {
555555
},
556556
},
557557
},
558-
{
559-
method: "UUID",
560-
args: []any{p([...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})},
561-
562-
expected: expected{
563-
Type: &Ydb.Type{
564-
Type: &Ydb.Type_OptionalType{
565-
OptionalType: &Ydb.OptionalType{
566-
Item: &Ydb.Type{
567-
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
568-
},
569-
},
570-
},
571-
},
572-
Value: &Ydb.Value{
573-
Value: &Ydb.Value_NestedValue{
574-
NestedValue: &Ydb.Value{
575-
Value: &Ydb.Value_Low_128{
576-
Low_128: 651345242494996240,
577-
},
578-
High_128: 72623859790382856,
579-
},
580-
},
581-
},
582-
},
583-
},
584558
{
585559
method: "Uuid",
586560
args: []any{p(uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})},

internal/params/parameters.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ func (p *Parameter) YSON(v []byte) Builder {
297297
return p.parent
298298
}
299299

300-
// removed for https://github.com/ydb-platform/ydb-go-sdk/issues/1501
301-
//func (p *Parameter) UUID(v [16]byte) Builder {
302-
// return p.UUIDWithIssue1501Value(v)
303-
//}
300+
//// removed for https://github.com/ydb-platform/ydb-go-sdk/issues/1501
301+
////func (p *Parameter) UUID(v [16]byte) Builder {
302+
//// return p.UUIDWithIssue1501Value(v)
303+
////}
304304

305305
// UUIDWithIssue1501Value is field serializer for save data with format bug.
306306
// For any new code use Uuid

internal/params/set.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ func (s *setItem) YSON(v []byte) *set {
168168
return s.parent
169169
}
170170

171-
// UUID has data corruption bug and will be removed in next version.
171+
//// UUID has data corruption bug and will be removed in next version.
172+
////
173+
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
174+
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
175+
//func (s *setItem) UUID(v [16]byte) *set {
176+
// s.parent.values = append(s.parent.values, value.UUIDWithIssue1501Value(v))
172177
//
173-
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
174-
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
175-
func (s *setItem) UUID(v [16]byte) *set {
176-
s.parent.values = append(s.parent.values, value.UUIDWithIssue1501Value(v))
177-
178-
return s.parent
179-
}
178+
// return s.parent
179+
//}
180180

181181
func (s *setItem) Uuid(v uuid.UUID) *set { //nolint:revive,stylecheck
182182
s.parent.values = append(s.parent.values, value.Uuid(v))

internal/params/set_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -346,22 +346,6 @@ func TestSet(t *testing.T) {
346346
},
347347
},
348348
},
349-
{
350-
method: "UUID",
351-
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
352-
353-
expected: expected{
354-
Type: &Ydb.Type{
355-
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
356-
},
357-
Value: &Ydb.Value{
358-
Value: &Ydb.Value_Low_128{
359-
Low_128: 651345242494996240,
360-
},
361-
High_128: 72623859790382856,
362-
},
363-
},
364-
},
365349
{
366350
method: "Uuid",
367351
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

0 commit comments

Comments
 (0)