Skip to content

Commit d23b959

Browse files
committed
Merge remote-tracking branch 'tonsky/master'
2 parents 0a3ce97 + 0fd30aa commit d23b959

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4019
-3355
lines changed

.github/workflows/build_test.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ jobs:
1515
test:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919
- name: Choose Java 11
2020
run: |
2121
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
2222
echo "$JAVA_HOME_11_X64/bin" >> $GITHUB_PATH
23-
- name: Set up Clojure
24-
uses: DeLaGuardo/setup-clojure@12.1
23+
- name: Setup Clojure
24+
uses: DeLaGuardo/setup-clojure@12.5
2525
with:
26-
cli: 1.11.1.1413
27-
26+
cli: latest
2827
- run: ./script/test_clj.sh
2928
- run: clojure -M:shadow-cljs:test compile test && node target/datascript.js
3029
# - run: ./script/test_js.sh

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ web/target-cljs
2929
.rebl
3030
.shadow-cljs
3131
demos/node_storage/target
32+
.clj-kondo

CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
# 1.7.1 - Jun 20, 2024
2+
3+
- Regression: :db.fn/call returning entity without :db/id #474 #475 via @DerGuteMoritz
4+
5+
# 1.7.0 - Jun 19, 2024
6+
7+
- Stable sorting of sequences of various types #470
8+
- Correctly restore `:max-tx` from storage
9+
- Fixed tempid/upsert resolution when multiple tempids are added first #472
10+
- Allow upsert by implicit tuple when only tuple components are specified #473
11+
- Allow lookup-refs inside tuples used for lookup-refs #452
12+
13+
# 1.6.5 - May 3, 2024
14+
15+
- Regression: fixed some OR queries broken in 1.6.4 #468 #469
16+
17+
# 1.6.4
18+
19+
- Implement “constant substitution” optimization for queries #462
20+
- Fixed :max-eid for dangling entities during reader-based serialization #463
21+
- Fixed tempid in unique refs #464
22+
- Pass through BigInteger/BigDeciman to freeze-fn in serializable #465 #466
23+
24+
# 1.6.3
25+
26+
- Fix regression in 1.6.2 #460 via @galdre
27+
28+
# 1.6.2
29+
30+
- Query: shortcircuit clause resolution when result is guaranteed to be empty #459 via @galdre
31+
32+
# 1.6.1
33+
34+
- Fixed JS version bug caused by Conn rewrite
35+
36+
# 1.6.0
37+
38+
- [ BREAKING ] Implement Conn as a single atom with extend-clj
39+
- Only breaking if you relied on getting listneres from Conn meta
40+
- Before: `@(:listeners (meta conn))`
41+
- After: `(:listeners @(:atom conn))`
42+
- prevent explosion of redundant tuples during rule solving #457, thx @RutledgePaulV
43+
44+
# 1.5.4
45+
46+
- Fixed: `:xform` is not called on ref attributes #455
47+
148
# 1.5.3
249

350
- Added: `d/reset-schema!`, `d/with-schema`

README.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ The intention with DataScript is to be a basic building block in client-side app
1818
## Latest version [![Build Status](https://travis-ci.org/tonsky/datascript.svg?branch=master)](https://travis-ci.org/tonsky/datascript)
1919

2020
```clj
21-
[datascript "1.5.3"]
21+
;; lein
22+
[datascript "1.7.1"]
23+
```
24+
```clj
25+
;; deps.edn
26+
datascript/datascript {:mvn/version "1.7.1"}
2227
```
2328

2429
Important! If you are using shadow-cljs, add
@@ -79,6 +84,7 @@ Projects using DataScript:
7984
- [LightMesh](http://lightmesh.com/), datacenter management
8085
- [PartsBox](https://partsbox.io/), electronic parts management
8186
- [I am Fy](https://www.iamfy.co/), accessories e-shop
87+
- [Under Whose Command?](https://myanmar.securityforcemonitor.org/), an interactive report by Security Force Monitor
8288
- [Pinfigurator](https://kevinlynagh.com/pinfigurator/), a microcontroller search tool
8389
- [Precursor](http://precursorapp.com/), collaborative prototyping tool
8490
- [Acha-acha](http://tonsky.me/blog/acha-acha/), GitHub achievements
@@ -177,7 +183,7 @@ For more examples, see [our acceptance test suite](test/datascript/test/).
177183
DataScript can be used from any JS engine without additional dependencies:
178184

179185
```html
180-
<script src="https://github.com/tonsky/datascript/releases/download/1.5.3/datascript-1.5.3.min.js"></script>
186+
<script src="https://github.com/tonsky/datascript/releases/download/1.7.1/datascript-1.7.1.min.js"></script>
181187
```
182188

183189
or as a CommonJS module ([npm page](https://www.npmjs.org/package/datascript)):
@@ -259,11 +265,7 @@ Interface differences:
259265
* Custom aggregate functions are called via aggregate keyword: `:find (aggregate ?myfn ?e) :in $ ?myfn`
260266
* Additional `:db.fn/retractAttribute` shortcut
261267
* Transactions are not annotated by default with `:db/txInstant`
262-
263-
Expected soon:
264-
265-
* Better error reporting
266-
* Proper documentation
268+
* When “transaction function” is called, the db that this function receive is a “partial db” relative to it's position in transaction.
267269

268270
## Differences from Datomic
269271

@@ -272,13 +274,10 @@ Expected soon:
272274
* Simplified schema, not queryable
273275
* Attributes do not have to be declared in advance. Put them to schema only when you need special behaviour from them
274276
* Any type can be used for values
275-
* No `:db/ident` attributes, keywords are _literally_ attribute values, no integer id behind them
277+
* No `:db/ident` for attributes, keywords are _literally_ attribute values, no integer id behind them
276278
* No schema migrations
277-
* No cache segments management, no laziness. Entire DB must reside in memory
278-
* No facilities to persist, transfer over the wire or sync DB with the server
279-
* No pluggable storage options, no full-text search, no partitions
279+
* No full-text search, no partitions
280280
* No external dependencies
281-
* Free
282281

283282
Aimed at interactive, long-living browser applications, DataScript DBs operate in constant space. If you do not add new entities, just update existing ones, or clean up database from time to time, memory consumption will be limited. This is unlike Datomic which keeps history of all changes, thus grows monotonically. DataScript does not track history by default, but you can do it via your own code if needed.
284283

@@ -319,6 +318,6 @@ Benchmark:
319318

320319
## License
321320

322-
Copyright © 2014–2021 Nikita Prokopov
321+
Copyright © 2014–2024 Nikita Prokopov
323322

324323
Licensed under Eclipse Public License (see [LICENSE](LICENSE)).

bench/datascript/bench/datascript.cljc

+16-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@
110110
[?e :sex :male]]
111111
@*db100k)))
112112

113+
(defn bench-q5-shortcircuit []
114+
(bench/bench
115+
(d/q '[:find ?e ?n ?l ?a ?s ?al
116+
:in $ ?n ?a
117+
:where [?e :name ?n]
118+
[?e :age ?a]
119+
[?e :last-name ?l]
120+
[?e :sex ?s]
121+
[?e :alias ?al]]
122+
@*db100k
123+
"Anastasia"
124+
35)))
125+
113126
(defn bench-qpred1 []
114127
(bench/bench
115128
(d/q '[:find ?e ?s
@@ -226,6 +239,7 @@
226239
"q2" bench-q2
227240
"q3" bench-q3
228241
"q4" bench-q4
242+
"q5-shortcircuit" bench-q5-shortcircuit
229243
"qpred1" bench-qpred1
230244
"qpred2" bench-qpred2
231245
"pull-one-entities" bench-pull-one-entities
@@ -277,6 +291,7 @@
277291
(bench-q2)
278292
(bench-q3)
279293
(bench-q4)
294+
(bench-q5-shortcircuit)
280295
(bench-qpred1)
281296
(bench-qpred2)
282297
(bench-pull-one-entities)
@@ -298,4 +313,4 @@
298313
(bench-rules-long-30x3)
299314
(bench-rules-long-30x5)
300315
(bench-freeze)
301-
(bench-thaw))
316+
(bench-thaw))

deps.edn

+40-25
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
1-
{:deps {org.clojars.tiensonqin/persistent-sorted-set {:mvn/version "0.0.6"}}
1+
{:deps
2+
{org.clojars.tiensonqin/persistent-sorted-set {:mvn/version "0.0.6"}
3+
io.github.tonsky/extend-clj {:mvn/version "0.1.0"}}
24

3-
:aliases {:1.9 {:override-deps {org.clojure/clojure {:mvn/version "1.9.0"}}}
5+
:aliases
6+
{:cljs
7+
{:extra-paths ["test"]
8+
:extra-deps
9+
{org.clojure/clojurescript {:mvn/version "1.11.132"}}}
410

5-
:1.10 {:override-deps {org.clojure/clojure {:mvn/version "1.10.2"}}}
11+
:1.9
12+
{:override-deps
13+
{org.clojure/clojure {:mvn/version "1.9.0"}}}
614

7-
:1.11.1 {:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}}
15+
:1.10
16+
{:override-deps
17+
{org.clojure/clojure {:mvn/version "1.10.2"}}}
818

9-
:dev {:extra-paths ["dev"]
10-
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.3.0"}}}
11-
:shadow-cljs
12-
{:extra-deps {thheller/shadow-cljs {:mvn/version "2.19.0"}}
13-
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
19+
:1.11.1
20+
{:override-deps
21+
{org.clojure/clojure {:mvn/version "1.11.1"}}}
1422

15-
:test {:extra-paths ["test"]
16-
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.51"}
17-
metosin/jsonista {:mvn/version "0.3.3"}
18-
cheshire/cheshire {:mvn/version "5.10.0"}
19-
com.cognitect/transit-clj {:mvn/version "1.0.324"}
20-
com.cognitect/transit-cljs {:mvn/version "0.8.269"}}}
23+
:dev
24+
{:extra-paths ["dev" "test"]
25+
:jvm-opts ["-ea" "-Ddatascript.debug" "-Dclojure.main.report=stderr"]
26+
:extra-deps
27+
{io.github.tonsky/duti {:git/sha "fc833a87a8687b67e66281e216eeee1ad6048168"}
28+
metosin/jsonista {:mvn/version "0.3.3"}
29+
cheshire/cheshire {:mvn/version "5.10.0"}
30+
com.cognitect/transit-clj {:mvn/version "1.0.324"}
31+
com.cognitect/transit-cljs {:mvn/version "0.8.269"}}}
2132

22-
:bench {:extra-paths ["bench"]
23-
:jvm-opts ["-server"
24-
"-XX:+UnlockDiagnosticVMOptions"
25-
"-Djdk.attach.allowAttachSelf"
26-
"-XX:+DebugNonSafepoints"]
27-
:extra-deps {metosin/jsonista {:mvn/version "0.3.3"}
28-
criterium/criterium {:mvn/version "0.4.6"}
29-
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.0"}}}
33+
:bench
34+
{:extra-paths ["bench"]
35+
:jvm-opts ["-server"
36+
"-XX:+UnlockDiagnosticVMOptions"
37+
"-Djdk.attach.allowAttachSelf"
38+
"-XX:+DebugNonSafepoints"]
39+
:extra-deps
40+
{metosin/jsonista {:mvn/version "0.3.3"}
41+
criterium/criterium {:mvn/version "0.4.6"}
42+
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.0"}}}
3043

31-
:datomic {:extra-paths ["bench_datomic" "test_datomic"]
32-
:extra-deps {com.datomic/peer {:mvn/version "1.0.6735"}}}}}
44+
:datomic
45+
{:extra-paths ["bench_datomic" "test_datomic"]
46+
:extra-deps
47+
{com.datomic/peer {:mvn/version "1.0.6735"}}}}}

dev/data_readers.clj

-1
This file was deleted.

dev/user.clj

+10-24
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
(ns user
22
(:require
3-
[clojure.tools.namespace.repl :as ns]))
3+
[duti.core :as duti]))
44

5-
(ns/set-refresh-dirs "src" "bench" "test" #_"bench_datomic" #_"test_datomic")
5+
(duti/set-dirs "src" "bench" "test" #_"bench_datomic" #_"test_datomic")
66

7-
(defn reload []
8-
(set! *warn-on-reflection* true)
9-
(let [res (ns/refresh)]
10-
(if (instance? Throwable res)
11-
(do
12-
(.printStackTrace ^Throwable res)
13-
(throw res))
14-
res)))
7+
(def reload
8+
duti/reload)
159

16-
(def lock
17-
(Object.))
10+
(def -main
11+
duti/-main)
1812

19-
(defn position []
20-
(let [trace (->> (Thread/currentThread)
21-
(.getStackTrace)
22-
(seq))
23-
el ^StackTraceElement (nth trace 4)]
24-
(str "[" (clojure.lang.Compiler/demunge (.getClassName el)) " " (.getFileName el) ":" (.getLineNumber el) "]")))
13+
(defn test-all []
14+
(duti/test #"datascript\.test\.(?!cljs).*"))
2515

26-
(defn p [form]
27-
`(let [t# (System/currentTimeMillis)
28-
res# ~form]
29-
(locking lock
30-
(println (str "#p" (position) " " '~form " => (" (- (System/currentTimeMillis) t#) " ms) " res#)))
31-
res#))
16+
(defn -test-main [_]
17+
(duti/test-exit #"datascript\.test\.(?!cljs).*"))

0 commit comments

Comments
 (0)