1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-03 22:24:14 +02:00

Feature/custom iterator (#173)

* Added CollectionIterator interface

* Added PAGINATION function

* Fixed LIMIT clause

* Fixed linting issues
This commit is contained in:
Tim Voronov
2018-11-12 19:58:12 -05:00
committed by GitHub
parent de774ba03e
commit 291d07cbef
18 changed files with 1275 additions and 720 deletions

View File

@@ -49,6 +49,15 @@ func (ds *DataSource) Iterate(ctx context.Context, scope *core.Scope) (collectio
default:
// fallback to user defined types
switch data.(type) {
case collections.IterableCollection:
collection := data.(collections.IterableCollection)
iterator, err := collection.Iterate(ctx)
if err != nil {
return nil, err
}
return collections.NewCollectionIterator(ds.valVariable, ds.keyVariable, iterator)
case collections.KeyedCollection:
return collections.NewIndexedIterator(ds.valVariable, ds.keyVariable, data.(collections.IndexedCollection))
case collections.IndexedCollection: