File tree 1 file changed +29
-2
lines changed
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 {
73
73
// Vals returns iterator over key/field at the current cursor position.
74
74
func (it * ScanIterator ) Vals (ctx context.Context ) iter.Seq [string ] {
75
75
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 {
78
105
return
79
106
}
80
107
}
You can’t perform that action at this time.
0 commit comments