1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-14 11:23:02 +02:00
ferret/pkg/runtime/collections/hash-table.go
Tim Voronov 0dfd58dc89
Feature/#1 array comparison operators (#71)
* #1 Added ALL IN

* #1 Completed Array operator

* #1 Fixed linting issues
2018-10-07 17:54:02 -04:00

26 lines
397 B
Go

package collections
import "github.com/MontFerret/ferret/pkg/runtime/core"
func ToHashTable(iterator Iterator) (map[uint64]core.Value, error) {
result := make(map[uint64]core.Value)
for iterator.HasNext() {
val, _, err := iterator.Next()
if err != nil {
return nil, err
}
h := val.Hash()
_, exists := result[h]
if !exists {
result[h] = val
}
}
return result, nil
}