Skip to content

Commit

Permalink
Merge pull request #178 from davidanthoff/collect_tofunc
Browse files Browse the repository at this point in the history
Add a collect method for function sinks
  • Loading branch information
davidanthoff committed May 14, 2018
2 parents 33a1231 + 2b58773 commit 49ade89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Query.jl v0.9.3 Release Notes
* Add the ability to collect into a function from LINQ style queries

# Query.jl v0.9.2 Release Notes
* Fix deprecation warning in IndexedTables tests

Expand Down
4 changes: 4 additions & 0 deletions src/sinks/sink_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function collect{T}(enumerable::Enumerable, ::Type{T})
return T(enumerable)
end

function collect(enumerable::Enumerable, f::Function)
return f(enumerable)
end

function collect{T, TS,Provider}(source::Queryable{TS,Provider}, ::Type{T})
collect(QueryOperators.query(collect(source)), T)
end

0 comments on commit 49ade89

Please sign in to comment.