From 9dbc1270b7bfdff895f2c68060747bdc5a48faf5 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Thu, 5 Dec 2024 17:07:23 +0300 Subject: [PATCH] removed ydb.MustParamsFromMap + fixed linter issues --- CHANGELOG.md | 2 +- example_test.go | 21 +++++++++++---------- params_map.go | 9 --------- topic/topictypes/topictypes_test.go | 2 -- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9de49739..a6e449b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/example_test.go b/example_test.go index df3644c68..2bebec81b 100644 --- a/example_test.go +++ b/example_test.go @@ -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, @@ -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") } diff --git a/params_map.go b/params_map.go index a39c364d5..3c36ff4da 100644 --- a/params_map.go +++ b/params_map.go @@ -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 } diff --git a/topic/topictypes/topictypes_test.go b/topic/topictypes/topictypes_test.go index 606e07610..3dc9f16da 100644 --- a/topic/topictypes/topictypes_test.go +++ b/topic/topictypes/topictypes_test.go @@ -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{} @@ -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{}