File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,35 @@ func (it *ScanIterator) Val() string {
7373// Vals returns iterator over key/field at the current cursor position.
7474func (it * ScanIterator ) Vals (ctx context.Context ) iter.Seq [string ] {
7575 return func (yield func (string ) bool ) {
76- for it .Next (ctx ) {
77- if ! yield (it .Val ()) {
76+ if it .cmd .Err () != nil {
77+ return
78+ }
79+
80+ for {
81+ for _ , val := range it .cmd .page {
82+ if ! yield (val ) {
83+ return
84+ }
85+ }
86+
87+ // Return if there is no more data to fetch.
88+ if it .cmd .cursor == 0 {
89+ return
90+ }
91+
92+ // Fetch next page.
93+ var cursorIndex int
94+ switch it .cmd .args [0 ] {
95+ case "scan" , "qscan" :
96+ cursorIndex = 1
97+ default :
98+ cursorIndex = 2
99+ }
100+
101+ it .cmd .args [cursorIndex ] = it .cmd .cursor
102+
103+ err := it .cmd .process (ctx , it .cmd )
104+ if err != nil {
78105 return
79106 }
80107 }
You can’t perform that action at this time.
0 commit comments