[jira] [Created] (GROOVY-8258) Create a LINQ-like DSL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Created] (GROOVY-8258) Create a LINQ-like DSL

JIRA jira@apache.org
Daniel Sun created GROOVY-8258:
----------------------------------

             Summary: Create a LINQ-like DSL
                 Key: GROOVY-8258
                 URL: https://issues.apache.org/jira/browse/GROOVY-8258
             Project: Groovy
          Issue Type: Improvement
            Reporter: Daniel Sun



*Example1:*
{code:java}
linq { // return an Iterator<Map<String, Object>>
    from c of categories
    from a of c.articles  // join
    where c.name == 'Groovy'
    orderBy a.voteNum desc // order by
    select { // create a map, its keys: articleName, voteNum, categoryName
        articleName = a.name
        a.voteNum
        categoryName = c.name
    }
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator<Article>
    from c of categories
    from a of c.articles  // join
    where c.name == 'Groovy'
    orderBy a.voteNum desc // order by
    select Article { // create an Article instance
        a.name
        a.voteNum
        categoryName = c.name
    }
}

TO BE CONTINUED...

{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Loading...