   {:pre [(map? filter) field]}
   (let [field (qp/formatted field)]
     {field (case          filter-type
+             ;; TODO: implement Crate equivalent for "BETWEEN"
              :between     ['between [(qp/formatted (:min-val filter)) (qp/formatted (:max-val filter))]]
              :starts-with ['like (qp/formatted (update value :value (fn [s] (str    s \%)))) ]
              :contains    ['like (qp/formatted (update value :value (fn [s] (str \% s \%))))]

         {:connection-details->spec  connection-details->spec
          :column->base-type         column->base-type
          :string-length-fn          (constantly :CHAR_LENGTH)
          :apply-filter              apply-filter}))

(extend CrateDriver
  driver/IDriver

            [metabase.driver.generic-sql.query-processor :as qp]
            (korma [core :as k])
            [korma.sql.engine :as kengine]
            [korma.sql.fns :as kfns]
            [metabase.util.korma-extensions :as kx]
            [korma.sql.utils :as kutils]
            [clj-time.format :as f]
            [clj-time.coerce :as c]
            [clj-time.core :as t])
  (:import (clojure.lang Named)
           (java.sql Timestamp)))


(defn- column->base-type
  "Map of Postgres column types -> Field base types.
   Add more mappings here as you come across them."
  [_ column-type]
  ({:integer   :IntegerField
    :string    :TextField
    :boolean   :BooleanField
    :byte      :IntegerField
    :short     :IntegerField
    :long      :BigIntegerField
    :float     :FloatField
    :double    :FloatField
    :ip        :UnknownField
    :timestamp :DateTimeField
    :geo_point :UnknownField
    :geo_shape :UnknownField
    } column-type))

;; # Adapt generic SQL to Crate SQL

