cMQL parts APIs

*cmql-core is written in .cljc files, shared in both cqml-j and cmql-js

*cmql is the core, written in .cljc files, shared in both cqml-j and cmql-js

Lein dependencies

  • [org.cmql/cmql-core "0.2.0-SNAPSHOT"]
  • [org.cmql/cmql-js "0.2.0-SNAPSHOT"]

Required namespaces

cMQL query functions like q,fq ... creates a local enviroment where all operators/stages are defined. The :use is not allowed in clojurescript, its only used for the IDE, before complile its auto-removed with as script.

The important cmql ones to see the API are the cmql-core.operators The important cmql-js ones to see the API are the cmql-js.commands and cmql-js.cmql-arguments cmql-j and cmql-js have similar namespaces structure.

(ns clojurescriptapp.example
(:use cmql-core.operators.operators
cmql-core.operators.options
cmql-core.operators.stages)
(:require
cmql-core.operators.operators ;;aggregate operators
cmql-core.operators.stages ;;aggregate stage operators
cmql-core.operators.options ;;some command options
[cmql-js.commands :refer-macros [q fq insert insert! delete! dq]]
[cmql-js.cmql-arguments :refer-macros [p f qf] :refer [o d]]
[cmql-js.driver.settings :refer [update-defaults defaults]]
[cmql-js.util :refer-macros [golet cmql]]
[cmql-js.driver.cursor
:refer [c-take-all] :refer-macros [c-take-all! c-print-all!]]
[cmql-js.driver.client :refer [create-mongo-client]]
[cljs.core.async :refer [go go-loop <! chan close! take!]]
[cljs.core.async.interop :refer-macros [<p! ]]]))

Clojurescript doesn't allow :use, but we need it for the auto-complete of IDE (for example cursive).
A small script calls usecljs.jar that makes the use comment before compile (in all project).
The 2nd line makes it a comment, and the 4th line restores it, this is usedful only while developing.

rm -rf target
java -jar usecljs-0.1.0-SNAPSHOT-standalone.jar 0
shadow-cljs compile app
java -jar usecljs-0.1.0-SNAPSHOT-standalone.jar 1
node target/main.js

cMQL internal namespaces

They are not used from the user directly.

Internal important used from from cMQL-j, cMQL-js

  • cmql-core.read-write
  • cmql-core.administration
  • cmql-core.users
  • cmql-core.roles
  • cmql-core.diagnostic

Internal use from cMQL

  • cmql-core.convert

Cursive

Cursive provides auto-complete, it also allows us to define how a symbol should be resolved. For example golet is a macro that combines let and go, we can tell cursive to resolve it as let. right-click on golet,show-context actions,and resolve as let (helps on showing the un-resolved symbols) We can do the same for if- to resolve it as if, that helps on spacing etc.