mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
0dfd58dc89
* #1 Added ALL IN * #1 Completed Array operator * #1 Fixed linting issues
26 lines
397 B
Go
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
|
|
}
|