Skip to content

Commit 833803f

Browse files
committed
Vectorize attach_ functions
1 parent 5b6080f commit 833803f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/helpers.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function funsql_attach_first(pair::Pair{Symbol, FunSQL.SQLNode}, predicate = tru
164164
end
165165
end
166166

167+
funsql_attach_first(pairs::Vector{Pair{Symbol, FunSQL.SQLNode}}, predicate = true; order_by) =
168+
foldr(|>, [funsql_attach_first(pair, predicate; order_by) for pair in pairs])
169+
funsql_attach_earliest(pairs::Vector{Pair{Symbol, FunSQL.SQLNode}}, predicate = true) =
170+
foldr(|>, [funsql_attach_earliest(pair, predicate) for pair in pairs])
171+
funsql_attach_latest(pairs::Vector{Pair{Symbol, FunSQL.SQLNode}}, predicate = true) =
172+
foldr(|>, [funsql_attach_latest(pair, predicate) for pair in pairs])
173+
167174
function funsql_join_with(pair::Pair{Symbol, FunSQL.SQLNode}, predicate=true)
168175
(name, base) = pair
169176
return @funsql(join($name => $base, $name.person_id == person_id && $predicate))

0 commit comments

Comments
 (0)