Skip to content

Commit

Permalink
Merge branch 'master' into fix-1506-optional-in-params
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	internal/params/optional_test.go
  • Loading branch information
rekby committed Oct 24, 2024
2 parents 85ba858 + b911372 commit 19cea5b
Show file tree
Hide file tree
Showing 32 changed files with 161 additions and 247 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/slo-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: slo-report

on:
workflow_run:
workflows: ['slo']
types:
- completed

jobs:
test-ydb-slo-action:
runs-on: ubuntu-latest
name: Publish YDB SLO Report
permissions:
contents: read
pull-requests: write
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Publish YDB SLO Report
uses: ydb-platform/ydb-slo-action/report@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* Fixed send optional arguments to the server with `ydb.ParamsBuilder`

## v3.88.0
* Removed UUID methods from ydb.ParamsBuilder()

## v3.87.0
* BREAK OLD STYLE WORK WITH UUID. See https://github.com/ydb-platform/ydb-go-sdk/issues/1501 for details.
At the version you must explicit choose way for work with uuid: old with bug or new (fixed).
Expand Down
5 changes: 5 additions & 0 deletions internal/cmd/gtrace/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ func (w *Writer) compose(trace *Trace) {
w.code(`func (`, t, ` *`, trace.Name, `) Compose(`, x, ` *`, trace.Name, `, opts ...`+trace.Name+`ComposeOption) `)
w.line(`*`, trace.Name, ` {`)
w.block(func() {
w.line(`if `, t, ` == nil {`)
w.block(func() {
w.line(`return x`)
})
w.line(`}`)
w.line(`var `, ret, ` `, trace.Name, ``)
if len(trace.Hooks) > 0 {
w.line(`options := `, unexported(trace.Name), `ComposeOptions{}`)
Expand Down
22 changes: 11 additions & 11 deletions internal/params/dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,18 @@ func (d *dictValue) YSON(v []byte) *dict {
return d.pair.parent
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (d *dictValue) UUID(v [16]byte) *dict {
// d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{
// K: d.pair.keyValue,
// V: value.UUIDWithIssue1501Value(v),
// })
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (d *dictValue) UUID(v [16]byte) *dict {
d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{
K: d.pair.keyValue,
V: value.UUIDWithIssue1501Value(v),
})

return d.pair.parent
}
// return d.pair.parent
//}

func (d *dictValue) Uuid(v uuid.UUID) *dict { //nolint:revive,stylecheck
d.pair.parent.values = append(d.pair.parent.values, value.DictValueField{
Expand Down
16 changes: 0 additions & 16 deletions internal/params/dict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,22 +347,6 @@ func TestDict(t *testing.T) {
},
},
},
{
method: "UUID",
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

expected: expected{
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
},
Value: &Ydb.Value{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
{
method: "Uuid",
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
Expand Down
16 changes: 8 additions & 8 deletions internal/params/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ func (l *listItem) YSON(v []byte) *list {
return l.parent
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (l *listItem) UUID(v [16]byte) *list {
// l.parent.values = append(l.parent.values, value.UUIDWithIssue1501Value(v))
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (l *listItem) UUID(v [16]byte) *list {
l.parent.values = append(l.parent.values, value.UUIDWithIssue1501Value(v))

return l.parent
}
// return l.parent
//}

func (l *listItem) Uuid(v uuid.UUID) *list { //nolint:revive,stylecheck
l.parent.values = append(l.parent.values, value.Uuid(v))
Expand Down
16 changes: 0 additions & 16 deletions internal/params/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,6 @@ func TestList(t *testing.T) {
},
},
},
{
method: "UUID",
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

expected: expected{
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
},
Value: &Ydb.Value{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
{
method: "Uuid",
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
Expand Down
16 changes: 8 additions & 8 deletions internal/params/optional.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ func (p *optional) YSON(v *[]byte) *optionalBuilder {
return &optionalBuilder{opt: p}
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (p *optional) UUID(v *[16]byte) *optionalBuilder {
// p.value = value.NullableUUIDValue(v)
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (p *optional) UUID(v *[16]byte) *optionalBuilder {
p.value = value.NullableUUIDValue(v)

return &optionalBuilder{opt: p}
}
// return &optionalBuilder{opt: p}
//}

func (p *optional) Uuid(v *uuid.UUID) *optionalBuilder { //nolint:revive,stylecheck
p.value = value.NullableUuidValue(v)
Expand Down
16 changes: 0 additions & 16 deletions internal/params/optional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,6 @@ func TestOptional(t *testing.T) {
},
},
},
{
method: "UUID",
args: []any{p([...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})},

expected: expected{
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
},
Value: &Ydb.Value{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
{
method: "Uuid",
args: []any{p(uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})},
Expand Down
8 changes: 4 additions & 4 deletions internal/params/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,10 @@ func (p *Parameter) YSON(v []byte) Builder {
return p.parent
}

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

// UUIDWithIssue1501Value is field serializer for save data with format bug.
// For any new code use Uuid
Expand Down
16 changes: 8 additions & 8 deletions internal/params/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ func (s *setItem) YSON(v []byte) *set {
return s.parent
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (s *setItem) UUID(v [16]byte) *set {
// s.parent.values = append(s.parent.values, value.UUIDWithIssue1501Value(v))
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (s *setItem) UUID(v [16]byte) *set {
s.parent.values = append(s.parent.values, value.UUIDWithIssue1501Value(v))

return s.parent
}
// return s.parent
//}

func (s *setItem) Uuid(v uuid.UUID) *set { //nolint:revive,stylecheck
s.parent.values = append(s.parent.values, value.Uuid(v))
Expand Down
16 changes: 0 additions & 16 deletions internal/params/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,6 @@ func TestSet(t *testing.T) {
},
},
},
{
method: "UUID",
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

expected: expected{
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
},
Value: &Ydb.Value{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
{
method: "Uuid",
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
Expand Down
22 changes: 11 additions & 11 deletions internal/params/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ func (s *structValue) YSON(v []byte) *structure {
return s.parent
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (s *structValue) UUID(v [16]byte) *structure {
// s.parent.values = append(s.parent.values, value.StructValueField{
// Name: s.name,
// V: value.UUIDWithIssue1501Value(v),
// })
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (s *structValue) UUID(v [16]byte) *structure {
s.parent.values = append(s.parent.values, value.StructValueField{
Name: s.name,
V: value.UUIDWithIssue1501Value(v),
})

return s.parent
}
// return s.parent
//}

func (s *structValue) Uuid(v uuid.UUID) *structure { //nolint:revive,stylecheck
s.parent.values = append(s.parent.values, value.StructValueField{
Expand Down
35 changes: 0 additions & 35 deletions internal/params/struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,41 +715,6 @@ func TestStruct(t *testing.T) {
},
},
},
{
name: xtest.CurrentFileLine(),
builder: Builder{}.Param("$x").BeginStruct().Field("col1").
UUID([...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}).EndStruct(),
params: map[string]*Ydb.TypedValue{
"$x": {
Type: &Ydb.Type{
Type: &Ydb.Type_StructType{
StructType: &Ydb.StructType{
Members: []*Ydb.StructMember{
{
Name: "col1",
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{
TypeId: Ydb.Type_UUID,
},
},
},
},
},
},
},
Value: &Ydb.Value{
Items: []*Ydb.Value{
{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
},
},
},
{
name: xtest.CurrentFileLine(),
builder: Builder{}.Param("$x").BeginStruct().Field("col1").
Expand Down
16 changes: 8 additions & 8 deletions internal/params/tuple.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ func (t *tupleItem) YSON(v []byte) *tuple {
return t.parent
}

// UUID has data corruption bug and will be removed in next version.
//// UUID has data corruption bug and will be removed in next version.
////
//// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
//// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
//func (t *tupleItem) UUID(v [16]byte) *tuple {
// t.parent.values = append(t.parent.values, value.UUIDWithIssue1501Value(v))
//
// Deprecated: Use Uuid (prefer) or UUIDWithIssue1501Value (for save old behavior) instead.
// https://github.com/ydb-platform/ydb-go-sdk/issues/1501
func (t *tupleItem) UUID(v [16]byte) *tuple {
t.parent.values = append(t.parent.values, value.UUIDWithIssue1501Value(v))

return t.parent
}
// return t.parent
//}

func (t *tupleItem) Uuid(v uuid.UUID) *tuple { //nolint:revive,stylecheck
t.parent.values = append(t.parent.values, value.Uuid(v))
Expand Down
16 changes: 0 additions & 16 deletions internal/params/tuple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,6 @@ func TestTuple(t *testing.T) {
},
},
},
{
method: "UUID",
args: []any{[...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},

expected: expected{
Type: &Ydb.Type{
Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID},
},
Value: &Ydb.Value{
Value: &Ydb.Value_Low_128{
Low_128: 651345242494996240,
},
High_128: 72623859790382856,
},
},
},
{
method: "Uuid",
args: []any{uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}},
Expand Down
Loading

0 comments on commit 19cea5b

Please sign in to comment.