Skip to content

JQL file specification

blixit edited this page Jan 29, 2017 · 1 revision

A JQL file is a file containing the jsonlikeql code. This file follows a simple structure described below :

types
[List of types]

functions
{
[List of declarations]
}

queries 
{
[List of queries]
}

types is the keyword after which you can add new types. functions is the keyword after which you can add some functions declarations. queries is the keyword after which you can add some queries.

Here is an instance of JQL file :

types

# let define the type User
User{
    id:Int,
    name:String,
    subscribed:Bool,
    resume:String,
    from:City #use the type City
} 
# let define the type City
City{
    id:Int,
    name:String
}

functions {
    :getUser(if:"subscribed=true") propagate default -> User
    +addUser() -> User
    !updateUser(if:"resume<>''") -> User
    -deleteUserIf1526(if:"id=1526") -> User
}

queries {
    :User propage default{
        id,
        name,
        subscribed,
        from{
            name
        }
    }
    :getUser # call to a function
    +addUser{ # call to a function
        name = "Blixit",
        subscribed = true,
        resume = "A long long text with the user resume"
    }
    -deleteUserIf1526() # call to a function
    -deleteUnsubscribed(if:"subscribed=false")
}
Clone this wiki locally