I agree that the proposed syntax is a bit quirky. The thought was
always to have the functions adapter-specific. Ie. dayofweek is a
native mysql and postgres function, but in sqlite we would convert it
to something like STRFTIME(created_at, 'D') where D is weekday. Don't
remember the exact function in sqlite, but you get the idea.

But as I mentioned to, when using this with ambition we can create
something truly beautiful. Most of the date-methods, string-methods,
and operators etc can be translated in ambition, so our queries can be
extremely versatile.

User.all{|u| u.name.length >= 10 && (u.born_at.year - Date.today.year)
> 18 } etc..

So if we find a decent syntax you're good to go? :-)

On Oct 29, 4:40 pm, Sam Smoot <[EMAIL PROTECTED]> wrote:
> Not a big fan of the syntax, but I like the overall idea.
>
> Maybe something like: Function::COUNT(:id),
> Function::YEAR(:created_at), etc?
>
> Or with the upcoming UoW work... dm.functions::COUNT(:id). Where
> dm#functions would return a Syntax class that could be adapter
> specific.
>
> -Sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to