rails / arel

A Relational Algebra
2.06k stars 390 forks source link

Arel node for an array element (suffix operator) #497

Closed printercu closed 6 years ago

printercu commented 7 years ago

Hi!

Is there any node for suffix operators to access array elements (postgresql's integer[] type) like this:

column = Table.arel_table[:column]
low = here_magic_happens(column, '[1]')
Table.where(low.eq nil).or(Table.where(low.gt 5))
# should result in this where clause:
# "table"."column"[1] IS NULL OR "table"."column"[1] > 5

Thank you!

tenderlove commented 6 years ago

Nope, there isn't. But if you send a pull request that implements it, we could talk about merging it in! 😀

printercu commented 6 years ago

@tenderlove can you please give some advises on this feature. Maybe there is already something very similar in the gem, or some class to inherit, module to include, etc.

Thank you!