ブラウザーとサーバーの両方で、データに対してSQLのようなクエリを実行する

Marak SquiresはJavaScriptのLINQ実装であるJSLINQをリリースしました 。これは、ブラウザー側とサーバー側の両方で機能します(たとえば、 node.js )。 JOIN、UNION、RANGE、DISTINCT、COUNTなどの構成がサポートされています。



参照:

ジャスリンク



var sample = JSLINQ(sampleData).

Where( function (item) { return item.FirstName == "Chris" ;}).

Select( function (item) { return item.FirstName;}).

OrderBy( function (item) { return item;});



* This source code was highlighted with Source Code Highlighter .






ちなみに、 XaocCPSはかつてjLinqプロジェクトについて話していましたが、Karl GertinはJSINQプロジェクトについても言及しました

jLinq



var results = jLinq.from(data.users)

.startsWith( "first" , "a" )

.orEndsWith( "y" )

.orderBy( "admin" , "age" )

.select();




* This source code was highlighted with Source Code Highlighter .






ジンク



var query = new jsinq.Query( '\

from order in $1 \

group order by order.customerId into g \

select {customerId: g.getKey(), items: g.sum(function(g) { return g.items; })} \

into h \

join customer in $0 on h.customerId equals customer.id \

where h.items > 10 \

orderby h.items descending \

select {lastname: customer.lastname, items: h.items} \

'
);



query.setValue(0, customers);

query.setValue(1, orders);

var result = query.execute();




* This source code was highlighted with Source Code Highlighter .







All Articles