A straightforward graph data query language inspired by GraphQL, designed to meet the need for Mars.
User {
id,
name,
age
}
Query will be parse to:
{
type: 'User',
fields : ['id','name','age']
}
User( age:21 ){
id,
name,
age
}
Query will be parse to:
{
type: 'User',
attrs : {
data : {
age : 21
}
},
fields : ['id','name','age']
}
User( age:21 ){
id,
name,
age
}
Query will be parse to:
{
type: 'User',
attrs : {
unFilledKeys : ['age']
},
fields : ['id','name','age']
}
User( age:21 ){
id,
name,
created Task : {
id,
content
}
}
Query will be parse to:
{
type : 'User',
attrs : {
data : {
age :21
}
},
fields : ['id', 'name'],
relations : {
'created Task' : {
name : 'created',
target : {
type : 'Task',
fields : ['id','content']
}
}
}
}
User( age:21 ){
id,
name,
Task assigned( content: 'run' ): {
id,
content
}
}
Query will be parsed to :
{
type : 'User',
attrs : {
data : {
age :21
}
},
fields : ['id', 'name'],
relations : {
'Task-assigned' : {
name : 'assigned',
reverse : true, //notice, this is a reverse relation
target : {
type : 'Task',
attrs : {
data : {
content : 'run'
}
},
fields : ['id','content']
}
}
}
}