Liking cljdoc? Tell your friends :D

rocksky.rsql

Builder for RSQL filter expressions, accepted by the filter parameter of the catalog and scrobble-feed queries (app.rocksky.song.getSongs, app.rocksky.artist.getArtists, app.rocksky.album.getAlbums, app.rocksky.scrobble.getScrobbles).

(require '[rocksky.rsql :as rsql])

(-> (rsql/eq :artist "Daft Punk") (rsql/and (rsql/gt :duration 200000)) (rsql/or (rsql/in :genre ["house" "electro"])) rsql/build) ;; => artist=="Daft Punk";duration=gt=200000,genre=in=(house,electro)

Fields are keywords or strings; dotted selectors reach joined entities (:track.artist → track.artist). String values are quoted and escaped automatically when they contain characters RSQL reserves; * wildcards pass through unquoted so (eq :artist "Daft*") matches case-insensitively.

Pure Clojure — no native lib, safe to require anywhere.

Builder for RSQL filter expressions, accepted by the `filter` parameter of
the catalog and scrobble-feed queries (app.rocksky.song.getSongs,
app.rocksky.artist.getArtists, app.rocksky.album.getAlbums,
app.rocksky.scrobble.getScrobbles).

  (require '[rocksky.rsql :as rsql])

  (-> (rsql/eq :artist "Daft Punk")
      (rsql/and (rsql/gt :duration 200000))
      (rsql/or (rsql/in :genre ["house" "electro"]))
      rsql/build)
  ;; => artist=="Daft Punk";duration=gt=200000,genre=in=(house,electro)

Fields are keywords or strings; dotted selectors reach joined entities
(:track.artist → track.artist). String values are quoted and escaped
automatically when they contain characters RSQL reserves; `*` wildcards
pass through unquoted so (eq :artist "Daft*") matches case-insensitively.

Pure Clojure — no native lib, safe to require anywhere.
raw docstring

andclj

(and a b)

Both sides must match (;). Shadows clojure.core/and inside this ns.

Both sides must match (`;`). Shadows clojure.core/and inside this ns.
sourceraw docstring

buildclj

(build f)

The RSQL expression string to send as the filter query param. Also accepts an already-built string and returns it unchanged.

The RSQL expression string to send as the `filter` query param. Also
accepts an already-built string and returns it unchanged.
sourceraw docstring

eqclj

(eq field value)

field==value — equals; * in string values is a wildcard.

`field==value` — equals; `*` in string values is a wildcard.
sourceraw docstring

geclj

(ge field value)

field=ge=value — greater than or equal.

`field=ge=value` — greater than or equal.
sourceraw docstring

gtclj

(gt field value)

field=gt=value — greater than.

`field=gt=value` — greater than.
sourceraw docstring

inclj

(in field values)

field=in=(a,b) — matches any of the values. Throws on an empty coll.

`field=in=(a,b)` — matches any of the values. Throws on an empty coll.
sourceraw docstring

is-not-nullclj

(is-not-null field)

field!=null — the field is not NULL.

`field!=null` — the field is not NULL.
sourceraw docstring

is-nullclj

(is-null field)

field==null — the field is NULL.

`field==null` — the field is NULL.
sourceraw docstring

leclj

(le field value)

field=le=value — less than or equal.

`field=le=value` — less than or equal.
sourceraw docstring

ltclj

(lt field value)

field=lt=value — less than.

`field=lt=value` — less than.
sourceraw docstring

neclj

(ne field value)

field!=value — not equals.

`field!=value` — not equals.
sourceraw docstring

orclj

(or a b)

Either side may match (,). Shadows clojure.core/or inside this ns.

Either side may match (`,`). Shadows clojure.core/or inside this ns.
sourceraw docstring

outclj

(out field values)

field=out=(a,b) — matches none of the values. Throws on an empty coll.

`field=out=(a,b)` — matches none of the values. Throws on an empty coll.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close