On Wednesday, May 9, 2018 at 11:28:38 AM UTC-7, Rodrigo Rosenfeld Rosas 
wrote:
>
> Em 09-05-2018 14:41, Jeremy Evans escreveu:
>
> On Wednesday, May 9, 2018 at 8:48:40 AM UTC-7, Rodrigo Rosenfeld Rosas 
> wrote: 
>>
>> Maybe something like Sequel.escaped_like / escaped_ilike? Or like2 / 
>> ilike2? Or compound_like? I'm not sure there will exist a very good name 
>> for that.
>>
>
> escaped_like and escaped_ilike sound the best to me.
>  
>
>> While on the subject, sometimes the application would perform an ilike 
>> against two fields, such as :name and :internal_name. Instead of using 
>> Sequel.| it would be great if I could provide a set of fields in the method:
>>
>> Sequel.ilike2 [:name, :internal_name], '%?%', params[:term]
>>
>
> Is this an AND or an OR?  The current like/ilike uses OR, so I guess OR 
> would make the most sense.
>
>
> It would be an OR. I didn't know this is already implemented in 
> like/ilike, good to know :)
>

Well, like/ilike use OR when given more than 2 arguments, but they don't 
currently handle the first argument being an array.  However, Dataset#grep 
can handle arrays of both columns and patterns.
 

> Since this would be often used with user terms, the API name might reflect 
>> this intention with something like Sequel.param_like / param_ilike or 
>> input_like / input_ilike.
>>
>
> That may be too specific.  There are reasons to use LIKE escaping outside 
> of input/web parameter handling.
>
> Is this something you would be interested in implementing?
>
>
> I'd certainly be interested in implementing, but I don't really think I 
> would have time this year to work on that. We lost a big client in December 
> and as a result I'm having to bootstrap a completely new application for a 
> new product and the deadlines are too tight this time and it will probably 
> remain this way for quite a lot of months I guess. However, as a side 
> product, I've first built a bootstrap application on top of Roda, Sequel 
> and Dio.js (a lightweight React.js mostly compatible library) and it's 
> already a separate project, as the deployment tool I use to implement 
> canary deployment and I intend to open source both once I get time to 
> polish them. I hope to write an article or a set of articles talking about 
> those projects once I find some time, and I hope to be able to do that even 
> before I'd be able to work on that escaped_like API, so it would be 
> unrealistic to expect me to work on them any time soon.
>
>
OK.  I'll add it to my todo list.  It may make the next release, depending 
on what else comes up.

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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to