Skip to content

ricardoekm/restQL-clojure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

restQL-clojure allows to run restQL queries directly in the JVM, making easy to fetch information from multiple services in the most efficient manner

restQL on travis-ci

Getting Started

Installation

Add restQL dependency to your project

Lein

[b2wdigital/restql-core "2.4.0"]

NPM

npm i @b2wdigital/restql

First query

Clojure

(require '[restql.core.api.restql :as restql])
(restql/execute-query :mappings { :user "http://your.api.url/users/:name" } :query "from user with name = $name" :params { :name "Duke Nukem" } )

Node

var restlq = require('@b2wdigital/restql')

// executeQuery(mappings, query, params, options) => <Promise>
restql
  .executeQuery(
    {user: "http://your.api.url/users/:name"},
    "from user with name = $name",
    { name: "Duke Nukem" })
  .then(response => console.log(response))
  .catch(error => console.log(error))

In the example above restQL will call user API passing "Duke Nukem" in the name param.

Our query language

The clause order matters when making restQL queries. The following is a full reference to the query syntax, available clauses and order.

[ [ use modifier = value ] ]

METHOD resource-name [as some-alias] [in some-resource]
  [ headers HEADERS ]
  [ timeout INTEGER_VALUE ]
  [ with WITH_CLAUSES ]
  [ [only FILTERS] OR [hidden] ]
  [ [ignore-errors] ]

e.g:

from search
    with
        role = "hero"

from hero as heroList
    with
        name = search.results.name

Learn more about restQL query language

Links

Reach the community

Who's talking about restQL

License

Copyright © 2016-2019 B2W Digital

Distributed under the MIT License.

About

Microservice query language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 99.9%
  • JavaScript 0.1%