-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2dd070
commit 47e0630
Showing
12 changed files
with
336 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
* Added `table.Session.ReadRows` | ||
|
||
## v3.48.8 | ||
* Fixed `sugar.RemoveRecursive()` for column table type | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
//go:build integration | ||
// +build integration | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/version" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/table" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/table/options" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/table/result/named" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/table/types" | ||
) | ||
|
||
func TestKeyValue(t *testing.T) { | ||
if version.Lt(os.Getenv("YDB_VERSION"), "23.3") { | ||
t.Skip("read rows not allowed in YDB version '" + os.Getenv("YDB_VERSION") + "'") | ||
} | ||
|
||
var ( | ||
scope = newScope(t) | ||
driver = scope.Driver() | ||
tablePath = scope.TablePath() | ||
id = int64(100500) | ||
value = "test value" | ||
) | ||
|
||
// set | ||
err := driver.Table().Do(scope.Ctx, func(ctx context.Context, s table.Session) error { | ||
return s.BulkUpsert(ctx, tablePath, types.ListValue(types.StructValue( | ||
types.StructFieldValue("id", types.Int64Value(id)), | ||
types.StructFieldValue("val", types.TextValue(value)), | ||
))) | ||
}) | ||
scope.Require.NoError(err) | ||
|
||
// get | ||
err = driver.Table().Do(scope.Ctx, func(ctx context.Context, s table.Session) error { | ||
rows, err := s.ReadRows(ctx, tablePath, types.ListValue(types.Int64Value(id)), | ||
options.ReadColumn("val"), | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
defer func() { | ||
_ = rows.Close() | ||
}() | ||
if !rows.HasNextResultSet() { | ||
return fmt.Errorf("no result sets") | ||
} | ||
if !rows.HasNextRow() { | ||
return fmt.Errorf("no rows") | ||
} | ||
if rows.CurrentResultSet().RowCount() != 1 { | ||
return fmt.Errorf("wrong rows count (%d)", rows.CurrentResultSet().RowCount()) | ||
} | ||
if rows.CurrentResultSet().ColumnCount() != 1 { | ||
return fmt.Errorf("wrong column count (%d)", rows.CurrentResultSet().ColumnCount()) | ||
} | ||
var actualValue int64 | ||
if err := rows.ScanNamed(named.Optional("val", &actualValue)); err != nil { | ||
return err | ||
} | ||
return rows.Err() | ||
}) | ||
scope.Require.NoError(err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.