Commit graph

812 commits

Author SHA1 Message Date
Richard Newman
d755cd860e Add externs file for Sqlite.jsm. 2016-09-08 19:11:44 -07:00
Richard Newman
97bc90ae30 Add a preload script to set up console.log for browser use as println. 2016-09-08 19:11:44 -07:00
Richard Newman
113cff42aa Add a stub datomish.core for browser code. 2016-09-08 19:11:44 -07:00
Richard Newman
9e4e95ce51 Default SQLite's user_version to zero.
I saw nil here with Sqlite.jsm.
2016-09-08 19:11:44 -07:00
Richard Newman
b11b6c92d9 Implement js-sqlite for browser code. 2016-09-08 19:11:44 -07:00
Richard Newman
1cfbf8498c Introduce js-sqlite as an abstraction wrapper around Sqlite.jsm and promise-sqlite. 2016-09-08 19:11:44 -07:00
Richard Newman
cc25ce33e2 Move platform-specific code into src-node. 2016-09-08 19:11:44 -07:00
Richard Newman
c4f5564b35 We need to monkey-patch setTimeout for Sandbox contexts. 2016-09-08 19:11:44 -07:00
Richard Newman
e76d7305d1 Split release-js into release-node and release-browser.
Also expand our clean targets, and rewrite our build targets to generate
different code for Node and Firefox.
2016-09-08 19:11:43 -07:00
Richard Newman
9dbda3d9d8 Pre: remove exec_repl.cljc. 2016-09-08 19:04:15 -07:00
Richard Newman
fb8d46a4d7 Pre: bump to the latest ClojureScript release. 2016-09-08 19:04:15 -07:00
Richard Newman
687fddf709 Pre: .gitignore. 2016-09-08 19:04:15 -07:00
Richard Newman
53322d8389 Pre: @arg -> @param to quiet cljsbuild warnings. 2016-09-08 19:04:15 -07:00
Nick Alexander
21f672f921 Serialize and de-serialize non-keyword schema values correctly. Fixes #52. r=rnewman 2016-09-07 17:31:59 -07:00
Nick Alexander
659c26339c Serialize and de-serialize non-keyword schema values correctly. Fixes #52. 2016-09-07 17:31:30 -07:00
Nick Alexander
562ced372d Add :db.fn/retractAttribute and :db.fn/retractEntity. Fixes #46. r=rnewman 2016-09-06 13:13:30 -07:00
Nick Alexander
362bdb2028 Add :db.fn/retractAttribute and :db.fn/retractEntity. Fixes #46.
There's no distinction made for fulltext attributes, since the values
found by the retractAttributes SELECT are already rowids into the
fulltext_values table and therefore need no additional mapping.
2016-09-06 13:13:20 -07:00
Nick Alexander
94bac9704b Pre: Use SQLite temp files in deftest-db.
These temp files will almost certainly live in memory only, speeding our
test suite evaluation significantly.  Before this patch, in a warmed
REPL environment I get:

Testing datomish.db-test

Ran 19 tests containing 97 assertions.
0 failures, 0 errors.
"Elapsed time: 1408.720681 msecs"
"Elapsed time: 1343.986464 msecs"
"Elapsed time: 1338.660762 msecs"

After this patch, in a warmed REPL environment I get:

Testing datomish.db-test

Ran 19 tests containing 97 assertions.
0 failures, 0 errors.
"Elapsed time: 587.605168 msecs"
"Elapsed time: 569.522333 msecs"
"Elapsed time: 589.080282 msecs"
2016-09-06 13:13:20 -07:00
Nick Alexander
cfdce12c1a Pre: Use deftest-db in tests. 2016-09-06 13:13:20 -07:00
Richard Newman
8e8dd21164 Implement :limit and :order-by-vars. Fixes #37. r=nalexander 2016-09-02 16:24:10 -07:00
Richard Newman
5424e61be4 Review comment: args -> inputs. 2016-09-02 16:23:30 -07:00
Richard Newman
1197764949 Implement :limit and :order-by-vars. Fixes #37.
We'd like this to be part of the query syntax itself, but doing so
requires extending DataScript's parser.

Instead we generalize our `args` to `options`, and take `:limit`
and `:order-by-vars`. The former must be an integer or nil, and the
latter is an array of `[var direction]` pairs.

This commit includes descriptive error messages and tests for success
and failure.
2016-09-02 08:32:45 -07:00
Nick Alexander
e48f58f5f4 Cache partition map and update materialized partition view once. Fixes #47. r=rnewman 2016-09-01 14:46:10 -07:00
Nick Alexander
d92016166a Cache partition map and update materialized partition view once. Fixes #47.
This caches a partition map per DB, which is helpful because it exposes
what the point in time DB partition state is, but is unhelpful because
the partition state can advance underneath the DB cache.  This is
generally true of the approach -- this can happen to the ident/entid
maps, and the datoms themselves -- so we'll roll with it for now.

This reduces the number of SQL UPDATE operations from linear in the
number of id-literals used to constant in the number of known
partitions.
2016-09-01 14:46:04 -07:00
Nick Alexander
d419554361 Revert "Add Datomic, for testing."
This reverts commit 1b1cc6f18e.

This should never have escaped the lab; Datomic is not a dependency of
Datomish.
2016-08-31 16:17:08 -07:00
Richard Newman
b2a1af30ed Implement type-aware querying, fulltext searching, fast importing, and much besides. Fixes #14, #30, #35, #39, #40, #42. r=nalexander 2016-08-30 18:24:12 -07:00
Richard Newman
7486c2a8ba Hacking on exec-repl. 2016-08-30 18:22:23 -07:00
Richard Newman
c89f1f74c5 Add some Tofino-ish tests. 2016-08-30 18:22:22 -07:00
Richard Newman
ae65ba14fb Review comment: move assoc-if to utils. 2016-08-30 18:22:22 -07:00
Richard Newman
6fbd63fed2 Review comment: clarity. 2016-08-30 18:22:22 -07:00
Richard Newman
495e5a737e Review comment: check that Datalog vars don't have a namespace.
And fix the only test that uses syntax-quote, which namespace-qualifies bare symbols.
2016-08-30 18:22:22 -07:00
Richard Newman
0f399eafb0 Review comment: better UUID support. 2016-08-30 18:22:22 -07:00
Richard Newman
7d684216f0 Extension: allow non-constant attributes in fulltext expressions. Fixes #42.
This change breaks compatibility with Datomic, but is useful when we simply want
to find entities linked somehow to matching content.
2016-08-30 18:22:22 -07:00
Richard Newman
31e354ae61 Correctly distinguish between fulltext-values and fulltext-datoms. 2016-08-30 18:22:22 -07:00
Richard Newman
a9b26f154a Add (currently unused) ability to generate CTEs. 2016-08-30 18:22:22 -07:00
Richard Newman
f225dbe734 Implement get-else. 2016-08-30 18:22:22 -07:00
Richard Newman
38cd30a895 Implement aggregation. Fixes #39. 2016-08-30 18:22:22 -07:00
Richard Newman
1e04425287 Dates in and out. 2016-08-30 18:22:21 -07:00
Richard Newman
0cd6da1039 Add :db/doc as a default attribute. 2016-08-30 18:22:21 -07:00
Richard Newman
893f944596 Error out when an attribute could not be interned when transacting. 2016-08-30 18:22:11 -07:00
Richard Newman
7d63c2185d Rework query tests to use a live DB. Fixes #35. 2016-08-30 18:22:11 -07:00
Richard Newman
bdac50e03c Define deftest-db to do async testing with an open DB. 2016-08-30 18:22:11 -07:00
Richard Newman
479a7fd583 Project real values. Fixes #30. 2016-08-30 18:22:11 -07:00
Richard Newman
1c6244db5b Implement type-aware querying. Fixes #14.
* Alter how clauses are concatenated. They now preserve order more accurately.
* Track mappings between vars and extracted type columns.
* Generate type code constraints.
* Push known types down into :not.
* Push known types down into :or.
* Tests and test fixes.
2016-08-30 18:22:11 -07:00
Richard Newman
2529378725 Rewrite <resolve-lookup-refs to work for lookup refs.
Note that `go` (and `go-pair`) don't descend into `for` comprehensions
and other situations in which a fn is created. This commit rewrites to
use nested `loop`s, and also improves use of `<av`.
2016-08-30 18:22:11 -07:00
Richard Newman
86b5a8ea8a Rework <apply-entities to be 40% faster and not blow the stack in CLJS.
* Batch up datoms into a smaller number of queries, improving transact speed by about 50%.
* Restore transacting FTS attributes.
* Implement retraction of freetext datoms.
2016-08-30 18:22:11 -07:00
Richard Newman
9136ba7425 Basic test for ds/fulltext?. 2016-08-30 18:22:11 -07:00
Richard Newman
587959d1ff Simplify id-literal?, avoid some consing. 2016-08-30 18:22:11 -07:00
Richard Newman
b4112bbe52 Symbolicating is not expensive. 2016-08-30 18:22:10 -07:00
Richard Newman
43a96efd32 Memoize and simplify parts of insertion. 2016-08-30 18:22:10 -07:00