ReQL: pluses and minuses of pipeline-style queries

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 26 05:10:40 PDT 2015


On Sunday, 26 April 2015 at 01:03:12 UTC, Rikki Cattermole wrote:
>
> I'm personally moving towards a DSL.
>
> unittest {
> 	auto myQuery = """
> using webdev.base.orm.query.parser.defs # allow for D class 
> name instead of table name
> ; # end of \"sentence\"
>
> from MyModel
> where key == $0
> as simple
> # as index # but only one can be defined, two in total internal
> ; # end of \"sentence\"
>
> from MyModel
> where value contains $0
> as complex
> # as index # but only one can be defined, two in total internal
> ; # end of \"sentence\"
>
> """.query;
>
> 	MyModel[] gotValues = myQuery.simple("test");
> 	gotValues = myQuery.perform("complex", "another");
> }
>
> Pros:
> - Runtime reloadability
> - Runtime composability
> - More flexible
> Cons:
> - It's a string

Can Pegged be usefully applied to implement this?

Incidentally, it seems that although Hibernated is very nice, 
there is still work to be done.  Eg I would like to insert 10 
million rows, and it seems like a transaction would be the best 
way of doing so, but it's not yet supported.  No big deal since 
the schema is very simple and I can do it by hand, but it would 
be nice to have at some point.  (I looked at your own ORM, but 
keeping it in memory won't work for me).


More information about the Digitalmars-d mailing list