|
98 | 98 | (->> form |
99 | 99 | dedupe-interfaces |
100 | 100 | (remove (fn [method] |
101 | | - (when-let [impl (-> method get-sig impl-map)] |
| 101 | + (when-some [impl (-> method get-sig impl-map)] |
102 | 102 | (not= method impl))))) |
103 | 103 | form)) |
104 | 104 | body)))) |
|
860 | 860 | (defn validate-datom [db ^Datom datom] |
861 | 861 | (when (and (datom-added datom) |
862 | 862 | (is-attr? db (.-a datom) :db/unique)) |
863 | | - (when-let [found (not-empty (-datoms db :avet [(.-a datom) (.-v datom)]))] |
| 863 | + (when-some [found (not-empty (-datoms db :avet [(.-a datom) (.-v datom)]))] |
864 | 864 | (raise "Cannot add " datom " because of unique constraint: " found |
865 | 865 | {:error :transact/unique |
866 | 866 | :attribute (.-a datom) |
|
991 | 991 |
|
992 | 992 |
|
993 | 993 | (defn- upsert-eid [db entity] |
994 | | - (when-let [idents (not-empty (-attrs-by db :db.unique/identity))] |
| 994 | + (when-some [idents (not-empty (-attrs-by db :db.unique/identity))] |
995 | 995 | (->> |
996 | 996 | (reduce-kv |
997 | 997 | (fn [acc a v] ;; acc = [e a v] |
|
1217 | 1217 | ov (if (ref? db a) (entid-strict db ov) ov) |
1218 | 1218 | nv (if (ref? db a) (entid-strict db nv) nv) |
1219 | 1219 | _ (validate-val nv entity) |
1220 | | - datoms (-search db [e a])] |
| 1220 | + datoms (vec (-search db [e a]))] |
1221 | 1221 | (if (multival? db a) |
1222 | 1222 | (if (some (fn [^Datom d] (= (.-v d) ov)) datoms) |
1223 | 1223 | (recur (transact-add report [:db/add e a nv]) entities) |
|
1245 | 1245 | (recur (allocate-eid report e eid) (cons [op eid a v] entities))))) |
1246 | 1246 |
|
1247 | 1247 | (and (ref? db a) (tempid? v)) |
1248 | | - (if-let [vid (get tempids v)] |
| 1248 | + (if-some [vid (get tempids v)] |
1249 | 1249 | (recur report (cons [op e a vid] entities)) |
1250 | 1250 | (recur (allocate-eid report v (next-eid db)) es)) |
1251 | 1251 |
|
|
1263 | 1263 | (recur report entities)) |
1264 | 1264 |
|
1265 | 1265 | (= op :db.fn/retractAttribute) |
1266 | | - (if-let [e (entid db e)] |
1267 | | - (let [_ (validate-attr a entity) |
1268 | | - datoms (-search db [e a])] |
| 1266 | + (if-some [e (entid db e)] |
| 1267 | + (let [_ (validate-attr a entity) |
| 1268 | + datoms (vec (-search db [e a]))] |
1269 | 1269 | (recur (reduce transact-retract-datom report datoms) |
1270 | 1270 | (concat (retract-components db datoms) entities))) |
1271 | 1271 | (recur report entities)) |
1272 | 1272 |
|
1273 | 1273 | (or (= op :db.fn/retractEntity) |
1274 | 1274 | (= op :db/retractEntity)) |
1275 | | - (if-let [e (entid db e)] |
1276 | | - (let [e-datoms (-search db [e]) |
1277 | | - v-datoms (mapcat (fn [a] (-search db [nil a e])) (-attrs-by db :db.type/ref))] |
| 1275 | + (if-some [e (entid db e)] |
| 1276 | + (let [e-datoms (vec (-search db [e])) |
| 1277 | + v-datoms (vec (mapcat (fn [a] (-search db [nil a e])) (-attrs-by db :db.type/ref)))] |
1278 | 1278 | (recur (reduce transact-retract-datom report (concat e-datoms v-datoms)) |
1279 | 1279 | (concat (retract-components db e-datoms) entities))) |
1280 | 1280 | (recur report entities)) |
|
0 commit comments