Commit graph

230 commits

Author SHA1 Message Date
Nick Alexander
baec3815b0 Implement transactions. 2016-08-04 14:26:20 -07:00
Nick Alexander
0c51cb6236 Pre: Catch Throwable, not Exception. 2016-08-04 14:26:20 -07:00
Richard Newman
8a77dcd8f0 Implement simple 'or' clauses. r=nalexander 2016-07-27 17:04:32 -07:00
Richard Newman
1ad67a03eb Add tests and comments for clause ordering. 2016-07-26 11:19:51 -07:00
Richard Newman
a5556637e8 Add a table alias function to Source, allowing us to mock alias generation. 2016-07-26 10:50:40 -07:00
Richard Newman
5e1648b05f Remove a duplicate definition of context->sql-string. 2016-07-26 10:50:10 -07:00
Richard Newman
8633efc6be Fix exec-repl to build in cljs. 2016-07-26 10:49:43 -07:00
Richard Newman
d9cff5fa3c Hacking on exec-repl. 2016-07-25 17:08:53 -07:00
Richard Newman
42361c1e5e Implement negation, predicates, external scalar bindings, <?q. r=nalexander 2016-07-25 17:08:00 -07:00
Nick Alexander
9ae9a0572b Pass a Context into query. 2016-07-19 10:35:39 -07:00
Nick Alexander
f4b9b867a4 Indenting. 2016-07-19 10:35:39 -07:00
Nick Alexander
4262b10f55 Handle empty :where SQL clauses in query. 2016-07-19 10:35:39 -07:00
Nick Alexander
13dc1cc9b6 Take more general raise from DataScript. 2016-07-19 10:35:35 -07:00
Richard Newman
2a31a0c4d4 Fix error in pair-channel->lazy-seq.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-15 12:37:01 -07:00
Richard Newman
e76895ac00 Generalize test code for <?run to work in either environment.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-15 12:36:46 -07:00
Richard Newman
d695554123 Initial work on executing queries. r=nalexander
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-15 09:01:44 -07:00
Richard Newman
437a80a978 Store elements on the context. 2016-07-15 09:01:44 -07:00
Richard Newman
64460f7eef eavt -> datoms.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-15 09:01:44 -07:00
Richard Newman
6c367616e6 Add while-let.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-15 08:58:12 -07:00
Nick Alexander
bf080ced3c Part 2: Add ISQLiteConnectionFactory and CLJC test that uses it. 2016-07-13 18:19:22 -07:00
Nick Alexander
cca5010671 Part 1: Fix testing errors.
Some of these were just typos, but `with-open` was fatally flawed on
CLJS (we couldn't call `.close` at all), and `deftest-async` was hiding
all failures (due to a typo).
2016-07-13 18:19:22 -07:00
Nick Alexander
900e77862e Implement database on top of SQLite connection. r=rnewman
We would prefer to talk about a knowledge base on top of a database, but
all the Datomic and DataScript code (and symbols, like :db/add, etc)
refer to the "database of datoms", so let's roll with that nomenclature
and try to be specific that the persistent storage-layer is SQLite.
This will become more clear when we actually use SQLite's unique
capabilities for text indexing.
2016-07-13 12:37:23 -07:00
Nick Alexander
636b7a7957 Pre: Delete trailing whitespace. 2016-07-13 12:04:29 -07:00
Richard Newman
db68a714f6 First pass at translating Datalog queries into SQL. r=nalexander
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-13 09:51:42 -07:00
Nick Alexander
724c37466d Add an SQLite connection abstraction. 2016-07-12 13:56:26 -07:00
Nick Alexander
d42e2f02a6 Expose with-open to CLJS. 2016-07-12 13:56:26 -07:00
Nick Alexander
d5cfbeaa45 Add tempfile and with-tempfile to CLJS.
We already have a nice library like this for CLJ (tempfile); this builds
the same thing for CLJS, using Node.js's tmp.
2016-07-12 13:56:26 -07:00
Nick Alexander
0a312b4f40 Add an async and async testing framework.
This is a well-worn idea: use a `promise-channel` of `[result nil]` or
`[nil error]` pairs.  The `go-pair` and `<?` macros handle catching
exceptions (important, given that synchronous CLJ code expects to throw
rather than return an error promise or similar), allowing code like:
```
(go-pair
  (let [result (<? (pair-chan-fn))]
    (when (not result)
      (throw (Exception. "No result!")))
    (transform result)))
```
to be expressed naturally.  These are the equivalents of `async` and
`await` in JS.

The implementation is complicated by significant incompatibilities
between CLJ and CLJS.  The solution presented here takes care to
separate the macro definitions into CLJ.  Sadly, this requires
namespacing the per-environment symbols explicitly; but we hope to
minimize such code in files like this.

The most significant restriction to this approach is that consumers must
require the transitive dependencies of the macro-defining modules.  See
the included tests (both CLJ and CLJS) for the appropriate
incantations (for pair-chan, core.async, and test).
2016-07-12 13:56:26 -07:00
Nick Alexander
f2365646d2 Add lein-cljsbuild and adapt datascript's release-js vehicle. 2016-07-06 16:42:37 -07:00
Richard Newman
9e3df19798 Stub code, build, and REPL.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-05 12:36:55 -07:00