MechanicalRabbit / FunSQL.jl

Julia library for compositional construction of SQL queries
https://mechanicalrabbit.github.io/FunSQL.jl
Other
144 stars 5 forks source link

smarter Or #57

Closed clarkevans closed 3 months ago

clarkevans commented 4 months ago

I find that I have to write the following for Or to be useful.

function build_or(items...)
    if length(items) == 0
        return @funsql(false)                       
    end
    if length(items) == 1
        return items[1]    
    end
    return @funsql(or($items...))
end
xitology commented 4 months ago

That's how it works already, see https://github.com/MechanicalRabbit/FunSQL.jl/blob/master/src/translate.jl#L257-L293. You can write @funsql or(args = items).