On Sunday, October 1, 2017 at 10:55:23 AM UTC-7, Gustavo Caso wrote: > > Hi I'm currently working on a couple of feature for Rom-rb that use sequel > underneath and the last feature I'm working is for adding Postgres LTree > data type https://www.postgresql.org/docs/9.6/static/ltree.html > > So in order to be a full implementation, I would need to been able to add > query methods like `@>` or `<@` looking in the sequel code base I seen > sequel expresion that allow me to work pretty nicely, but when it comes to > custom expression or not defined in the SQL class is there a way I can > build it usng Sequel. > > This would be a typical implementation query method for rom: > > def match(type, expr, query) > Attribute[SQL::Types::Bool].meta(sql_expr: > Sequel::SQL::BooleanExpression.new(:'~', expr, query)) > end > > I get an error if I try to create an expression like this > `Sequel::SQL::BooleanExpression.new(:'@>', expr, query)` > > Is there any other way? >
You should look at how the existing pg_*_ops extensions are implemented. They basically use custom objects that return (possibly wrapped) PlaceholderLiteralString instances for the results of operator methods. I'd certainly consider including a pg_ltree_ops extension with Sequel, assuming it used a similar design as the existing pg_*_ops extensions, and came with extension and postgres adapter tests. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
