Liking cljdoc? Tell your friends :D

metabase.mbql.schema.helpers


clauseclj

(clause clause-name & arg-schemas)

Impl of defclause macro.

Impl of `defclause` macro.
sourceraw docstring

defclausecljmacro

(defclause clause-name & arg-names-and-schemas)

Define a new MBQL clause.

(defclause field-id, id su/IntGreaterThanZero)

The first arg is the name of the clause, and should be followed by pairs of arg name, arg schema. Arg schemas may optionally be wrapped in optional or rest to signify that the arg is optional, or to accept varargs:

(defclause count, field (optional Field)) (defclause and, filters (rest Filter))

Since there are some cases where clauses should be parsed differently in MBQL (such as expressions in the expressions clause vs in aggregations), you can give the actual symbol produced by this macro a different name as follows:

(defclause [ag:+ +] ...) ; define symbol ag:+ to be used for a [:+ ...] clause

Define a new MBQL clause.

  (defclause field-id, id su/IntGreaterThanZero)

The first arg is the name of the clause, and should be followed by pairs of arg name, arg schema. Arg schemas may
optionally be wrapped in `optional` or `rest` to signify that the arg is optional, or to accept varargs:

  (defclause count, field (optional Field))
  (defclause and, filters (rest Filter))

Since there are some cases where clauses should be parsed differently in MBQL (such as expressions in the
`expressions` clause vs in aggregations), you can give the actual symbol produced by this macro a different name as
follows:

  (defclause [ag:+ +] ...) ; define symbol `ag:+` to be used for a `[:+ ...]` clause
sourceraw docstring

is-clause?clj

(is-clause? k-or-ks x)

If x an MBQL clause, and an instance of clauses defined by keyword(s) k-or-ks?

(is-clause? :count [:count 10]) ; -> true (is-clause? #{:+ :- :* :/} [:+ 10 20]) ; -> true

If `x` an MBQL clause, and an instance of clauses defined by keyword(s) `k-or-ks`?

(is-clause? :count [:count 10])        ; -> true
(is-clause? #{:+ :- :* :/} [:+ 10 20]) ; -> true
sourceraw docstring

one-ofcljmacro

(one-of & clauses)

Define a schema that accepts one of several different MBQL clauses.

(one-of field-id field-literal)

Define a schema that accepts one of several different MBQL clauses.

(one-of field-id field-literal)
sourceraw docstring

one-of*clj

(one-of* & clause-names+schemas)

Interal impl of one-of macro.

Interal impl of `one-of` macro.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close