[Nitro] Ruby as an Og query language

zimba.tm zimba.tm at gmail.com
Thu Feb 2 12:42:23 EST 2006


Replying to myself...

Ez is in Nitro's darcs repository.

If you intend to use ez as a ruby DSL to SQL, why not call it 'og/query' ?

On Thursday 02 February 2006 17:07, zimba.tm wrote:
> On Thursday 02 February 2006 15:03, George Moschovitis wrote:
> > Dear devs,
> >
> > I added some experimental support for Caboose/EZ in the repo version of
> > Og. This allows you to use Ruby as the query language for Og. Here is an
> > example:
> >
> > user = User.ez_find { |user|
> >   user.age > 10
> >   user.any {
> >     name == 'George'
> >     name == 'Stella'
> >   }
> > }
> >
> > # => SELECT * FROM oguser WHERE (oguser.age > 10 AND (oguser.name =
> > 'George' OR oguser.name = 'Stella'))
>
> I like the idea of havind a Ruby DSL for SQL queries. Is there a source
> where we can get the code ? RubyForge didn't have any published.
>
> Is it possible to use the find options as selectors ? Like
>
> User.find(:name, :surname) { |user|
>   user.age < 20
>   user.surname.any = ['George', 'Stella']
>   ['Moschovitis'].include? user.name
> }
>
> Is it possible to do generic queries ?
>
> Og.select(User.name, Message.body) {
>   where {
>     User.name < 20 and Message.body.length > 0
>   }
>   join { Message.user = User }
> }
>
> Is it possible to use the OR operator and sub-conditions like (x AND y) OR
> (z OR r) ?
>
> > Eventually this will be a standard option for find (I dont like ez_find).
>
> Is it possible to have both available on find ? I think find doesn't use a
> block yet.
>
> > This is still early code and I will work with Ezra (the original
> > author of EZ) to better integrate this with Og. I would like to hear
> > your additional suggestions. For example I would like a suggestion for
> > naming this feature. I plan to use 'natural' as in 'Og natural
> > querying'.
> >
> > regards,
> > George.
> >
> >
> > --
> > http://www.gmosx.com
> > http://www.navel.gr
> > http://www.nitrohq.com
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general



More information about the Nitro-general mailing list