From a5cbd76f5029cb6b56c0b4ff96bb70bedd8af9a4 Mon Sep 17 00:00:00 2001 From: Dan Peddle Date: Sun, 26 Jan 2020 21:19:26 +0100 Subject: [PATCH 1/2] prefer sniffing entity-ishness to having a concrete datomic dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Entities _always_ have a `:db/id` property. In the case that a user has passed something with this key, and it’s not an Entity, we’re fine too, as we also don’t want to treat maps as sequences. --- src/pour/core.clj | 5 ++--- test/pour/core_test.clj | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pour/core.clj b/src/pour/core.clj index b4f8be8..3db9ecc 100644 --- a/src/pour/core.clj +++ b/src/pour/core.clj @@ -1,10 +1,9 @@ (ns pour.core (:require [edn-query-language.core :as eql]) - (:import (clojure.lang Seqable) - (datomic Entity))) + (:import (clojure.lang Seqable))) (defn seqy? [s] - (and (not (instance? Entity s)) + (and (not (:db/id s)) ; ie, a datomic Entity or similar (not (map? s)) (instance? Seqable s))) diff --git a/test/pour/core_test.clj b/test/pour/core_test.clj index 85690e2..8a533de 100644 --- a/test/pour/core_test.clj +++ b/test/pour/core_test.clj @@ -6,6 +6,7 @@ (defrecord Test [a b]) (deftest seqy + (is (not (pour/seqy? {:db/id 123}))) (is (not (pour/seqy? {}))) (is (not (pour/seqy? nil))) (is (not (pour/seqy? "hi"))) From 442e0d78d1c844d1d7442ae2fa1a7a720d2f0b7a Mon Sep 17 00:00:00 2001 From: Dan Peddle Date: Sun, 26 Jan 2020 21:21:31 +0100 Subject: [PATCH 2/2] move datomic-free dependency to `test` alias --- deps.edn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/deps.edn b/deps.edn index 1db7ba7..ff8d9ea 100644 --- a/deps.edn +++ b/deps.edn @@ -1,12 +1,13 @@ {:paths ["src"] :deps {edn-query-language/eql {:mvn/version "0.0.9"} - aysylu/loom {:mvn/version "1.0.2"} - com.datomic/datomic-free {:mvn/version "0.9.5697" - :exclusions [commons-codec - joda-time]}} + aysylu/loom {:mvn/version "1.0.2"}} + :aliases {:provided {:extra-deps {org.clojure/clojure {:mvn/version "1.10.1"} org.clojure/clojurescript {:mvn/version "1.10.597"}}} :test {:extra-paths ["test" "dev"] - :extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git" + :extra-deps {com.datomic/datomic-free {:mvn/version "0.9.5697" + :exclusions [joda-time + commons-codec]} + com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git" :sha "f7ef16dc3b8332b0d77bc0274578ad5270fbfedd"}} :main-opts ["-m" "cognitect.test-runner"]}}}