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.(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.
(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.
(eq field value)field==value — equals; * in string values is a wildcard.
`field==value` — equals; `*` in string values is a wildcard.
(ge field value)field=ge=value — greater than or equal.
`field=ge=value` — greater than or equal.
(gt field value)field=gt=value — greater than.
`field=gt=value` — greater than.
(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.
(is-not-null field)field!=null — the field is not NULL.
`field!=null` — the field is not NULL.
(is-null field)field==null — the field is NULL.
`field==null` — the field is NULL.
(le field value)field=le=value — less than or equal.
`field=le=value` — less than or equal.
(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.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |