88 "github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
99 "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Query"
1010
11+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/query/result"
1112 "github.com/ydb-platform/ydb-go-sdk/v3/internal/types"
1213 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
1314 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xiter"
@@ -41,6 +42,23 @@ type (
4142 }
4243)
4344
45+ func rangeRows (ctx context.Context , rs result.Set ) xiter.Seq2 [result.Row , error ] {
46+ return func (yield func (result.Row , error ) bool ) {
47+ for {
48+ rs , err := rs .NextRow (ctx )
49+ if err != nil {
50+ if xerrors .Is (err , io .EOF ) {
51+ return
52+ }
53+ }
54+ cont := yield (rs , err )
55+ if ! cont || err != nil {
56+ return
57+ }
58+ }
59+ }
60+ }
61+
4462func (* materializedResultSet ) Close (context.Context ) error {
4563 return nil
4664}
@@ -49,11 +67,11 @@ func (rs *resultSetWithClose) Close(ctx context.Context) error {
4967 return rs .close (ctx )
5068}
5169
52- func (rs * materializedResultSet ) Rows (ctx context.Context ) xiter.Seq2 [query .Row , error ] {
70+ func (rs * materializedResultSet ) Rows (ctx context.Context ) xiter.Seq2 [result .Row , error ] {
5371 return rangeRows (ctx , rs )
5472}
5573
56- func (rs * resultSet ) Rows (ctx context.Context ) xiter.Seq2 [query .Row , error ] {
74+ func (rs * resultSet ) Rows (ctx context.Context ) xiter.Seq2 [result .Row , error ] {
5775 return rangeRows (ctx , rs )
5876}
5977
0 commit comments