On Friday, November 2, 2018 at 4:09:02 AM UTC-7, Janko Marohnić wrote:
>
> You can give to the `.where` definitions anything that you would give to a 
> normal #where dataset method. So you can still build complex conditions, 
> because you have Sequel's expression API at your disposal:
>
> dataset_module do
>   where :a, Sequel[:a] >= 1
>   where :b, Sequel[:b] !~ 2
>   where :c, Sequel[:c].like('3')
> end
>
> or via virtual row blocks:
>
> dataset_module do
>   where(:a) { a >= 1 }
>   where(:b) { b !~ 2 }
>   where(:c) { c.like('3') }
> end
>
> In that case the conditions are already expression objects, so you can 
> just `&` and `|` them directly. This means that in
>
> def abnotc
>   where((Sequel[a_conditions] & b_conditions) | c_conditions)
> end
>
> you can lose the Sequel[]:
>
> def abnotc
>   where((a_conditions & b_conditions) | c_conditions)
> end
>
> Jeremy, maybe a note that expressions and virtual row blocks are supported 
> could be added to the subset_conditions documentation.
>

That makes sense to me, could you send in a PR?

We could also consider adding support for exclude so that *_conditions 
methods are created that return inverted conditions.

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.

Reply via email to