     (ffirst (d/q query db email))))
 
 
-(defn- get-tx-id [eid attr]
+(defn- get-tx-id [conn eid attr]
   (let [query '[:find ?tx
                 :in $ ?e ?attr
                 :where [?e ?attr _ ?tx]]


(defn add-bookmark
  "Transact bookmark and return the resulting datom"
  [{:keys [url title email] :as bookmark}]
  (do
    (transact-bookmark bookmark)
    (get-bookmark bookmark)))


(defn get-user-bookmarks
  "Find user's bookmarks"
  [email]
  (let [query '[:find ?url ?title ?tx
                :in $ ?email
                :where

(defn- scratch-conn
  "Create a connection to an anonymous, in-memory database."
  []
  (let [uri (str "datomic:mem://" (d/squuid))]
    (d/delete-database uri)
    (d/create-database uri)
    (d/connect uri)))


(defn db-conn []
  (let [uri (str db-uri-base "/lesezeichen")]
    (d/create-database uri)
    (d/connect uri)))


(defn init-schema [path]
  (transact-all conn (io/resource path)))


(defn add-user [conn {:keys [email]}]
  (d/transact
   conn
   [{:db/id (d/tempid :db.part/user)
     :user/email email}]))


(defn- get-user-id [conn email]
  (let [query '[:find ?e
               :in $ ?email
               :where
