coryodaniel / arbor

Ecto elixir adjacency list and tree traversal. Supports Ecto versions 2 and 3.
MIT License
239 stars 26 forks source link

function instead of macro #12

Closed coryodaniel closed 5 years ago

coryodaniel commented 7 years ago

It might be nice to have this implemented as a function instead of a macro that can be called arbitrarily instead of having to be used.

Arbor.Tree.children(struct)

I had experimented with this originally, but using fragment when postgres objects were interpolated they were interpreted as strings, so you would get stuff like:

SELECT * from 'comments'

Which obviously blows up. I think this could be possible with a custom ecto datatype that type cast postgres objects correctly.

coryodaniel commented 5 years ago

This isn't possible to use a table name in a prepared statement: https://www.postgresql.org/docs/9.1/xfunc-sql.html