Commit graph

586 commits

Author SHA1 Message Date
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
Richard Newman
ef0454dd43 Depend on promise-sqlite for Node.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-13 18:16:59 -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
Richard Newman
75810b924e Use cljsbuild 1.1.3.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-12 19:06:37 -07:00
Richard Newman
3aac28aa13 Take a dependency on honeysql for building queries.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-12 19:05:39 -07:00
Richard Newman
b3b9982740 Take a dependency on DataScript.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-12 19:05:18 -07:00
Richard Newman
798e05bd9a Use correct project name in defproject.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-12 19:04:53 -07:00
Richard Newman
655d361a4c Ignore /out/. 2016-07-12 19:04:53 -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
Richard Newman
ca62b7b5d2 Might as well ignore .cljs_rhino_repl too. 2016-07-08 11:23:18 -07:00
Richard Newman
1cf2c4fba7 Fix wrapper.prefix to refer to the right library name. r=nalexander
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-08 11:23:04 -07:00
Nick Alexander
08f7084d92 Add lein-doo to run ClojureScript tests. 2016-07-06 16:42:40 -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
55baa1685d More README tweaks.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-06 12:14:24 -07:00
Richard Newman
6db476d265 Document the process of starting a REPL or connecting from Vim.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-06 11:19:52 -07:00
Richard Newman
adee532770 Add notes comparing to raw SQLite.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-05 17:43:47 -07:00
Richard Newman
27d35f030d Take dependencies on a few libraries.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-05 17:01:27 -07:00
Richard Newman
df08fe23d0 Improve BUILDING.md. 2016-07-05 12:38:55 -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
Richard Newman
f7621712df Stub out Leiningen and npm project files.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-05 12:36:45 -07:00
Richard Newman
3a56c159fa Add initial README.md and CONTRIBUTING.md.
Signed-off-by: Richard Newman <rnewman@twinql.com>
2016-07-05 12:36:37 -07:00
Richard Newman
2fc1b884bf Initial commit 2016-07-05 11:29:35 -07:00