(ns metabase.lib.dispatch (:require [metabase.util :as u])) | |
(defn- mbql-clause-type [x]
(when (and (vector? x)
(keyword? (first x)))
(first x))) | |
Dispatch value for a clause, map, or other object. Dispatch rules are as follows:
| (defn dispatch-value
[x]
;; TODO -- for Clj, we should probably handle Toucan instances as well, and dispatch off
;; of [[toucan2.core/model]]?
(or (mbql-clause-type x)
(when (map? x)
(:lib/type x))
(u/dispatch-type-keyword x))) |