Skip to content

Commit 6cdc6a2

Browse files
author
Hayim Shaul
committed
remove commented code
Signed-off-by: Hayim Shaul <[email protected]>
1 parent 6f658dd commit 6cdc6a2

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

platform/common/utils/collections/iterators.go

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ type baseIterator[k any] interface {
1616
// Next returns the next item in the result set. The `QueryResult` is expected to be nil when
1717
// the iterator gets exhausted
1818
Next() (k, error)
19-
// // Peek returns the next item in the result set. It does not change the location of the iterator.
20-
// Peek() (k, error)
21-
// // Peek returns the last item in the result set. It does not change the location of the iterator.
22-
// PeekLast() (k, error)
2319
}
2420

2521
type Iterator[V any] interface {
@@ -48,16 +44,6 @@ func readAll[T any](it Iterator[*T]) []*T {
4844
return items
4945
}
5046

51-
// // Return the record the iterator points at. Does not change where the iterator points to
52-
// func Peek[T any](it Iterator[*T]) (*T, error) {
53-
// return it.Peek()
54-
// }
55-
56-
// // Return the record the iterator points at. Does not change where the iterator points to
57-
// func PeekLast[T any](it Iterator[*T]) (*T, error) {
58-
// return it.PeekLast()
59-
// }
60-
6147
func ReadFirst[T any](it Iterator[*T], limit int) ([]T, error) {
6248
defer it.Close()
6349
items := make([]T, 0)
@@ -118,16 +104,6 @@ func (it *sliceIterator[T]) Next() (T, error) {
118104
return item, nil
119105
}
120106

121-
// func (it *sliceIterator[T]) Peek() (T, error) {
122-
// item := it.items[it.i]
123-
// return item, nil
124-
// }
125-
126-
// func (it *sliceIterator[T]) PeekLast() (T, error) {
127-
// item := it.items[len(it.items)-1]
128-
// return item, nil
129-
// }
130-
131107
func (it *sliceIterator[K]) HasNext() bool { return it.i < len(it.items) }
132108

133109
func (it *sliceIterator[T]) Close() {
@@ -156,16 +132,6 @@ func (it *permutationIterator[T]) Next() (T, error) {
156132
return item, nil
157133
}
158134

159-
// func (it *permutationIterator[T]) Peek() (T, error) {
160-
// item := it.items[it.perm[it.i]]
161-
// return item, nil
162-
// }
163-
164-
// func (it *permutationIterator[T]) PeekLast() (T, error) {
165-
// item := it.items[it.perm[len(it.items)]]
166-
// return item, nil
167-
// }
168-
169135
func (it *permutationIterator[T]) HasNext() bool { return it.i < len(it.items) }
170136

171137
func (it *permutationIterator[T]) Close() {
@@ -190,22 +156,6 @@ func (it *mappedIterator[A, B]) Next() (B, error) {
190156
}
191157
}
192158

193-
// func (it *mappedIterator[A, B]) Peek() (B, error) {
194-
// if p, err := it.Iterator.Peek(); err != nil {
195-
// return utils.Zero[B](), err
196-
// } else {
197-
// return it.transformer(p)
198-
// }
199-
// }
200-
201-
// func (it *mappedIterator[A, B]) PeekLast() (B, error) {
202-
// if p, err := it.Iterator.PeekLast(); err != nil {
203-
// return utils.Zero[B](), err
204-
// } else {
205-
// return it.transformer(p)
206-
// }
207-
// }
208-
209159
func NewEmptyIterator[K any]() *emptyIterator[K] { return &emptyIterator[K]{zero: utils.Zero[K]()} }
210160

211161
type emptyIterator[K any] struct{ zero K }
@@ -215,7 +165,3 @@ func (i *emptyIterator[K]) HasNext() bool { return false }
215165
func (i *emptyIterator[K]) Close() {}
216166

217167
func (i *emptyIterator[K]) Next() (K, error) { return i.zero, nil }
218-
219-
// func (i *emptyIterator[K]) Peek() (K, error) { return i.zero, nil }
220-
221-
// func (i *emptyIterator[K]) PeekLast() (K, error) { return i.zero, nil }

platform/view/services/db/driver/sql/common/unversioned.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -247,22 +247,6 @@ func (t *readIterator) Next() (*driver.UnversionedRead, error) {
247247
return &r, err
248248
}
249249

250-
// func (t *readIterator) Peek() (*driver.UnversionedRead, error) {
251-
// var r driver.UnversionedRead
252-
// err := t.txs.Scan(&r.Key, &r.Raw)
253-
// return &r, err
254-
// }
255-
256-
// func (t *readIterator) PeekLast() (*driver.UnversionedRead, error) {
257-
// // TODO: verify that changing last does not change t
258-
// last := t.txs
259-
// for last.Next() {
260-
// }
261-
// var r driver.UnversionedRead
262-
// err := last.Scan(&r.Key, &r.Raw)
263-
// return &r, err
264-
// }
265-
266250
func (db *UnversionedPersistence) CreateSchema() error {
267251
return InitSchema(db.writeDB, fmt.Sprintf(`
268252
CREATE TABLE IF NOT EXISTS %s (

0 commit comments

Comments
 (0)