Commit graph

234 commits

Author SHA1 Message Date
Richard Newman
d6c074830f Implement a JS interface for Datomish, demonstrating it with a small Firefox add-on. Fixes #53. r=nalexander 2016-09-22 16:42:18 -07:00
Richard Newman
9587311412 Include deps.cljs giving externs for Node.js consumers; normalize build output.
cljsbuild using leiningen projects that depend on Datomish will
automatically include the externs.
2016-09-22 16:24:37 -07:00
Richard Newman
d0a04a5e56 Review comment: extracted shared go-promise. 2016-09-22 16:24:37 -07:00
Richard Newman
03d8d178fb Add CREDITS file for the icon the add-on uses. 2016-09-22 16:24:37 -07:00
Richard Newman
155f9b6d98 Add Public Domain license to addon code. 2016-09-22 16:24:37 -07:00
Richard Newman
548340c655 Copy the built datomish.js when building the add-on. 2016-09-22 16:24:37 -07:00
Richard Newman
17d7eaec7b Add a babelified test file, Webpack the add-on, and make the JS API work.
We concatenate a simple setTimeout monkeypatch onto the add-on itself.
2016-09-22 15:59:15 -07:00
Richard Newman
360f7622e8 Add handling of simple schemas. Fixes #53. 2016-09-22 15:59:15 -07:00
Richard Newman
bae1cfdc77 Alter release node config to be a bit more human-readable. 2016-09-22 15:59:15 -07:00
Richard Newman
4f37a86039 Use cljify in promise-sqlite. 2016-09-22 15:59:15 -07:00
Richard Newman
ea027e8cea Implement cljify. 2016-09-22 15:59:15 -07:00
Richard Newman
1d53d547b8 Externs. 2016-09-22 12:43:36 -07:00
Richard Newman
330433a45c Add externs file for Node's use of promise_sqlite. 2016-09-22 12:43:35 -07:00
Richard Newman
d178c53dcb Use normal sqlite3 and promise_sqlite. 2016-09-22 12:43:35 -07:00
Richard Newman
77fb997785 Fix source paths. 2016-09-22 12:43:35 -07:00
Nick Alexander
2e9a0f089c Include src/node in global source-paths. r=me
When consuming Datomish from another leiningen project, the .cljs files
need to be included as well.
2016-09-21 13:47:20 -07:00
Nick Alexander
1a30306314 Move datomish.api into exported namespace. 2016-09-19 12:03:09 -07:00
Richard Newman
b5aec2e890 Move src-node and src-browser into subdirectories of src. 2016-09-09 12:07:03 -07:00
Richard Newman
ac253bfea0 Make Datomish work in a Firefox add-on on top of Sqlite.jsm. Fixes #48. r=nalexander 2016-09-09 09:26:19 -07:00
Richard Newman
ee2dca05d0 Add a restartless add-on to load Datomish in Firefox. 2016-09-08 19:11:44 -07:00
Richard Newman
418bb34d57 Add is-node?. 2016-09-08 19:11:44 -07:00
Richard Newman
5ccc725b56 Flesh out JS API. 2016-09-08 19:11:44 -07:00
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