Skip to content

Commit

Permalink
removed ydb.MustParamsFromMap + fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Dec 5, 2024
1 parent c539324 commit 9dbc127
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Marked as deprecated `ydb.MustParamsFromMap`
* Removed experimental helper `ydb.MustParamsFromMap`
* Changed result of experimental helper `ydb.ParamsFromMap` from tuple <`params.Parameters`, `error`> to `params.Parameters` only

## v3.93.1
Expand Down
21 changes: 11 additions & 10 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ func ExampleOpen_advanced() {
fmt.Printf("connected to %s, database '%s'", db.Endpoint(), db.Name())
}

// func ExampleParamsMap
func ExampleMustParamsFromMap() {
func ExampleParamsFromMap() {
ctx := context.TODO()
db, err := ydb.Open(
ctx,
Expand All @@ -532,14 +531,16 @@ func ExampleMustParamsFromMap() {
fmt.Printf("connected to %s, database '%s'", db.Endpoint(), db.Name())

res, err := db.Query().QueryRow(ctx, `
DECLARE $textArg AS Text;
DECLARE $intArg AS Int64;
SELECT $textArg AS TextField, $intArg AS IntField
`, query.WithParameters(ydb.ParamsFromMap(map[string]any{
"$textArg": "asd",
"$intArg": int64(123),
})))
DECLARE $textArg AS Text;
DECLARE $intArg AS Int64;
SELECT $textArg AS TextField, $intArg AS IntField
`,
query.WithParameters(ydb.ParamsFromMap(map[string]any{
"$textArg": "asd",
"$intArg": int64(123),
})),
)
if err != nil {
fmt.Printf("query failed")
}
Expand Down
9 changes: 0 additions & 9 deletions params_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ import (
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
)

// MustParamsFromMap build parameters from named map, panic if error
//
// Deprecated: use explicitly ParamsFromMap
// Will be removed after June 2025.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func MustParamsFromMap(m map[string]any) params.Parameters {
return ParamsFromMap(m)
}

type wrongParameters struct {
err error
}
Expand Down
2 changes: 0 additions & 2 deletions topic/topictypes/topictypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func TestTopicDescriptionFromRaw(t *testing.T) {
}

for _, v := range testData {
v := v
t.Run(
v.testName, func(t *testing.T) {
d := TopicDescription{}
Expand Down Expand Up @@ -322,7 +321,6 @@ func TestTopicConsumerDescriptionFromRaw(t *testing.T) {
},
}
for _, v := range testData {
v := v
t.Run(
v.testName, func(t *testing.T) {
d := TopicConsumerDescription{}
Expand Down

0 comments on commit 9dbc127

Please sign in to comment.