Open millllllz opened 3 years ago
You should be able to pipe the operations into other statements:
test "given a struct w/ returns its descendants" do
[root | tail] = create_chatter("pupperinos")
_cat_comments = create_chatter("kittehs")
dog_thread =
root
|> Comment.descendants()
|> Comment.by_inserted_at()
|> Repo.all()
assert dog_thread == tail
end
This may be an odd use case, but having an earlier inserted_at
, doesn't necessarily indicate that the node is a parent. A new parent could be created and have the child added to it, for example.
You should be able to pipe into any Ecto query (order, where, join, etc)
Thanks,
Cory O’Daniel
On Dec 3, 2020, at 11:48 AM, JasonMiller notifications@github.com wrote:
This may be an odd use case, but having an earlier inserted_at, doesn't necessarily indicate that the node is a parent. A new parent could be created and have the child added to it, for example.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@JasonMiller circling back to this. Do you know if a default order by is set, will ecto overwrite that if someone pipes in an alternate order by or will it merge them?
This may be a personal preference, but I think this aligns more closely to similar projects.