Your proposed API sounds good to me. Em qua, 2 de mai de 2018 14:03, Jeremy Evans <[email protected]> escreveu:
> On Wednesday, May 2, 2018 at 7:27:43 AM UTC-7, Rodrigo Rosenfeld Rosas > wrote: >> >> Hi, very often I perform ilike searches for something like >> "%[search-term]%" where the search term would be typically provided by some >> user. That means I'm always escaping that search-term manually. It would be >> interested if we could specify the pattern in isolation from the term, so >> that Sequel could escape the filter. For example, we could provide a third >> param such as: >> >> Sequel.ilike(:column, '%@%', filter) which could replace @ with an >> escaped version of filter. Or anything instead of @, the important bit is >> to not leave the escaping to the end user. That should be even promoted as >> the good practice in my opinion... >> >> What do you think about that? >> > > I think the general idea is good. Sequel offers Dataset#escape_like, but > usage is definitely more cumbersome since it requires a dataset. This > approach would delay the escaping until the Sequel.ilike return object is > converted to SQL. In terms of the actual API, we should probably mimic > Sequel.lit's API: > > Sequel.ilike(:column, '%?%', 1) > Sequel.ilike(:column, '%?%?', [1, 2]) > Sequel.ilike(:column, '%:a%', :a=>1) > > I'm definitely interested in other ideas and community feedback regarding > this. > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sequel-talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sequel-talk/T3DZ8yzrif8/unsubscribe. > To unsubscribe from this group and all its topics, 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. > -- 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.
