SpahQL - A query language for Javascript objects
angryamoeba.co.uk
SpahQL - A query language for Javascript objects
1–10 of 37 posts
Re: SpahQL - A query language for Javascript objects
#2it would be more javascripty and would be another implementation (or a superset) of jsonpath
http://goessner.net/articles/JsonPath/ http://code.google.com/p/jsonpath/ https://github.com/joshbuddy/jsonpath https://github.com/marianoguerra/jsonpath-scala
Re: SpahQL - A query language for Javascript objects
#3SQlike is another effort in the same direction. It provides a wide range of SQL features including joins. JavaScript tables are used as query language.
See http://www.thomasfrank.se/sqlike.html for an overview and http://www.thomasfrank.se/SQLike/ for examples.
dataArray = [
{firstName: "Paul", lastName: "Stele", age:35, salary:35000},
...
]
dataArray2 = [
{firstName: "Paul", lastName: "Stele", favColor:"green"},
...
]
SQLike.q(
{
Select: ['*'],
From: dataArray,
Where: function(){return this.salary>50000},
OrderBy: ['salary','|desc|']
}
)
SQLike.q(
{
Select: ['*'],
From: {t1:dataArray},
NaturalJoin: {t2:dataArray2},
Where:function(){return this.t1.firstName!='Vicki'}
}
)Re: SpahQL - A query language for Javascript objects
#4have you considered adopting the jsonpath syntax? it would be more javascripty and would be another implementation (or a superset) of jsonpath http://goessner.net/articles/JsonPath/ http://code.google.com/p/jsonpath/ https://github.com/joshbuddy/jsonpath https://github.com/marianoguerra/jsonpath-scala
It's most certainly not perfect, but I had fun experimenting with it.
Re: SpahQL - A query language for Javascript objects
#5Re: SpahQL - A query language for Javascript objects
#6have you considered adopting the jsonpath syntax? it would be more javascripty and would be another implementation (or a superset) of jsonpath http://goessner.net/articles/JsonPath/ http://code.google.com/p/jsonpath/ https://github.com/joshbuddy/jsonpath https://github.com/marianoguerra/jsonpath-scala
Author here. I wanted to try something a little lighter than jsonpath and with a specific mode of (node collection|descent) that allowed set arithmetic to be the primary means of comparisons and assertions. This allowed me to obviate the need for scoped AND/OR structures and instead provide a broad range of assertion options using superset, subset, disjoint and joint set operations. It's most certainly not perfect, b…
but sometimes I think jsonpath should be more visible and it's not, that's why I was trying to avoid fragmentation for the same solution. But as you said, it tries a different approach so it makes sense to use a different syntax.
Re: SpahQL - A query language for Javascript objects
#7Interresting. SQlike is another effort in the same direction. It provides a wide range of SQL features including joins. JavaScript tables are used as query language. See http://www.thomasfrank.se/sqlike.html for an overview and http://www.thomasfrank.se/SQLike/ for examples. dataArray = [ {firstName: "Paul", lastName: "Stele", age:35, salary:35000}, ... ] dataArray2 = [ {firstName: "Paul", lastName: "Stele", favColor…
SpahQL is definitely much lighter than that - the API is intended to be more jquery-like with a specific selector language, each selection returning a resultset object which then provides methods for subselections and modifications.