From c5393243fd77010c4e806a7602f3dc9f0de29e77 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Thu, 5 Dec 2024 16:52:42 +0300 Subject: [PATCH] fix --- CHANGELOG.md | 2 +- example_test.go | 2 +- internal/params/parameters.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81e693768..d9de49739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ * Marked as deprecated `ydb.MustParamsFromMap` -* Changed result `ydb.ParamsFromMap` result from tuple <`params.Parameters`, `error`> to `params.Parameters` only +* Changed result of experimental helper `ydb.ParamsFromMap` from tuple <`params.Parameters`, `error`> to `params.Parameters` only ## v3.93.1 * Published `query.ExecuteOption` as alias to `internal/query/options.Execute` diff --git a/example_test.go b/example_test.go index b597fe665..df3644c68 100644 --- a/example_test.go +++ b/example_test.go @@ -536,7 +536,7 @@ DECLARE $textArg AS Text; DECLARE $intArg AS Int64; SELECT $textArg AS TextField, $intArg AS IntField -`, query.WithParameters(ydb.MustParamsFromMap(map[string]any{ +`, query.WithParameters(ydb.ParamsFromMap(map[string]any{ "$textArg": "asd", "$intArg": int64(123), }))) diff --git a/internal/params/parameters.go b/internal/params/parameters.go index e93578bba..75516c3d3 100644 --- a/internal/params/parameters.go +++ b/internal/params/parameters.go @@ -68,6 +68,10 @@ func (p *Params) String() string { } func (p *Params) ToYDB(a *allocator.Allocator) (map[string]*Ydb.TypedValue, error) { + if p == nil { + return nil, nil //nolint:nilnil + } + parameters := make(map[string]*Ydb.TypedValue, len(*p)) for _, param := range *p { parameters[param.name] = value.ToYDB(param.value, a)