 (ns er-cassandra.model.select
   (:require [manifold.deferred :as d]
+            [cats.core :as m]
+            [cats.monad.either :as either]
+            [cats.monad.deferred :as dm]
             [qbits.alia :as alia]
             [qbits.alia.manifold :as aliam]
             [qbits.hayt :as h]
             [er-cassandra.key :as k]
-            [er-cassandra.record :as r]
-            [er-cassandra.model.types])
+            [er-cassandra.record-either :as r]
+            [er-cassandra.model.types :as t])
   (:import [er_cassandra.model.types Model]))
 
 (defn if-primary-key-table

                               record-or-key-value
                               opts)

       (if-let [lookup-table (if-lookup-key-table model key)]

         (select-from-lookup-table session
                                   model

            t))
        (:secondary-tables model)))

(defn if-unique-key-table
  [^Model model key]
  (some (fn [t]
          (when (= (:key t) key)
            t))
        (:unique-key-tables model)))

(defn if-lookup-key-table
  [^Model model key]
  (some (fn [t]
          (when (= (:key t) key)
            t))
        (:lookup-key-tables model)))

(defn select-from-full-table
  "one fetch - straight from a table"
