Commit graph

418 commits

Author SHA1 Message Date
Richard Newman 5e3cdd1fc2 Implement query-translator. (#301) r=nalexander 2017-02-23 18:39:49 -08:00
Richard Newman 91c75f26c8 Expand query algebrizer. r=nalexander 2017-02-23 18:39:49 -08:00
Richard Newman 76f51015d9 Support accumulating TypedValue instances into a SQL query. (#339) r=nalexander
These expand into a collection of named variables that should be
passed via bind parameters when the query is executed.

Bind parameters are now only named.
2017-02-23 18:39:43 -08:00
Richard Newman b0120aa446 Pre: fix query/Cargo.toml indenting. 2017-02-23 18:31:57 -08:00
Richard Newman 14972fa6d7 Pre: use Option::cloned() instead of a cloning closure. 2017-02-23 18:31:54 -08:00
Joe Walker 40bca2df6d Remove most uses of use foo::* 2017-02-23 14:09:54 +00:00
Joe Walker 60b2e6f885 Improve Debug output for ConjoiningClauses; r=rnewman
Fixes #317, and also removes the '::' exploration of rust style
2017-02-23 14:05:56 +00:00
Victor Porof 7fc2a22d68 Implement a basic edn matcher, r=ncalexan (#271) (#338)
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-23 09:11:34 +01:00
Victor Porof bf707acbc3 Lint for the clippy gods in the edn crate (#340)
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-22 18:11:05 +01:00
Victor Porof 0d3b8e4b29 Avoid code duplication for common Value trait implementations, r=ncalexan
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-22 08:36:45 +01:00
Victor Porof 1b26e23d02 Implement edn pretty printing using pretty.rs. Fixes #195. (#245)
* Implement pretty printing

Signed-off-by: Victor Porof <victor.porof@gmail.com>

* Rewrite pretty printing.

This does a few things.  First, it use pretty.rs directly, without the
layer of macro obfuscation.  The code is significantly simpler as a
result.

Second, it tightens the layout, using pretty.rs to group nested
layouts that fit on a single line.  This is Clojure's EDN style, more
or less.

Third, it drops "special format" support for queries.  This wasn't
completely implemented; if we want it, we can newtype
Query(edn::Value) and figure out how to really implement this idea.

* Rename to reflect functionality.

* Make write interface more Rust-like.

There isn't a clear standard in the stdlib, but a function that takes
ownership of a writer and then returns it back is definitely not
Rust-like.  That's what a (mutable) reference is for.

* Review comment: Use as_ref to avoid cloning strings.

* Post: Fix tests to use `without_spans()`.
2017-02-21 11:48:08 -08:00
Richard Newman 7476d0c0c8 More Rust notes. 2017-02-21 10:45:21 -08:00
Richard Newman e18a0e9fdc Discuss Rust contributions. 2017-02-21 10:43:36 -08:00
Richard Newman 6fa907d2df Simplify .travis.yml to use cargo test --all. 2017-02-20 11:04:18 -08:00
Richard Newman a10f68fdb7 Mark every project as being part of the workspace. r=nalexander
This allows `cargo test --all` to work.
2017-02-20 11:04:08 -08:00
Richard Newman 42ae26ab46 Add new stuff to Travis. 2017-02-17 17:54:35 -08:00
Richard Newman 9ecd02ef95 Begin serializing queries to SQL. r=nalexander 2017-02-17 17:54:07 -08:00
Richard Newman a9cd9b1e87 Export symbols and string helpers from mentat_query_algebrizer. 2017-02-17 17:54:07 -08:00
Richard Newman f890995202 Add a rudimentary SQL builder, based on parts of Diesel. (#273) r=nalexander
https://github.com/diesel-rs/diesel/
2017-02-17 17:53:50 -08:00
Jordan Santell bc2b2ec4c8 Change to_namespaced_keyword(s) to return a Result rather than Option to (#333)
reduce error handling throughout db code. Fixes #331. r=nalexander
2017-02-17 16:10:34 -08:00
Jordan Santell 6f67f8563b TypedValue::Keyword now wraps a NamespacedKeyword rather than a String. Fixes #203. r=nalexander" (#329) 2017-02-17 14:07:57 -08:00
Jordan Santell a59f9583ac Store Idents as NamespacedKeywords, rather than Strings. Fixes #291. (#300)
r=ncalexander
2017-02-17 13:55:36 -08:00
Jordan Santell ec2bbb8e83 Ensure minimum rustc version in a build script. r=nalexander (#326)
Printing out failure to meet rustc version helps users during
setup with a helpful message if using an older rustc.
Rust version checking from http://stackoverflow.com/a/36607492.
2017-02-17 12:04:45 -08:00
Victor Porof 896d7f8f88 Add a span component to edn::Value, r=ncalexan
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-17 18:31:26 +01:00
Joe Walker d9b699b588 Fix the authors entry in Cargo.toml (#322) 2017-02-17 08:03:48 +01:00
Joe Walker 89949fb451 Update README for edn; r=me 2017-02-16 18:32:36 +00:00
Richard Newman 5af7082165 Partly flesh out query algebrizer. (#243) r=nalexander 2017-02-15 16:10:59 -08:00
Richard Newman f36a78e61e Test mentat_core and mentat_query_algebrizer on Travis. 2017-02-15 16:01:22 -08:00
Richard Newman 42f03f55a2 Stub out query algebrizer. 2017-02-15 16:01:22 -08:00
Richard Newman b165a0b2ad Implement Schema::attribute_for_ident. 2017-02-15 16:01:22 -08:00
Nick Alexander 16e9740d8a Implement upsert resolution algorithm. (#186, #283). r=rnewman, f=jsantell
* Pre: Implement batch [a v] pair lookup.

* Pre: Add InternSet for sharing ref-counted handles to large values.

* Pre: Derive more for Entity.

* Pre: Return DB from creating; return TxReport from transact.

I explicitly am not supporting opening existing databases yet, let
alone upgrading databases from earlier versions.  That can follow fast
once basic transactions are supported.

* Pre: Parse string temporary ID entities; remove ValueOrLookupRef.

This adds TempId entities, but we can't disambiguate String temporary
IDs from values without the use of the schema, so there's no new value
branch.  Similarly, we can't disambiguate lookup-ref values from two
element list values without a schema, so we remove this entirely.
We'll handle the ambiguity later in the transactor.

* Persist partitions to SQL store; allocate transaction ID. (#186)

* Post: Test upserting with vectors.

This converts an existing test to EDN:
84a80f40f5/test/datomish/db_test.cljc (L193).

* Implement tempid upsert resolution algorithm. (#184)

* Post: Separate Tx out of DB.

This is very preliminary, since we don't have a real connection type
to manage transactions and their metadata yet.

* Post: Comment on implementation choices in the transactor.

* Review comment: Put long use lists on separate lines.

* Review comment: Accept String: Borrow<S> instead of just String.

* Review comment: Address nits.
2017-02-14 16:50:40 -08:00
Richard Newman bfb62302cb Add docstrings for Schema methods. 2017-02-13 19:39:47 -08:00
Richard Newman a87e5a3ec7 Move Schema from mentat_db to mentat_core, improve API. (#290)
* Move Schema from mentat_db to mentat_core.
* Define SchemaMap in terms of Entid, not i64.
* Add Schema::{is_attribute,identifies_attribute}.
* Add pointer to #291.
* Don't pass around 64-bit pointers to 64-bit integers.
2017-02-13 19:20:20 -08:00
Richard Newman 2e303f4837 Stub out mentat::q_once. (#289) r=nalexander
* Leave a pointer to issue 288.
* Re-export mentat_db::types::DB from mentat_db.
* Parse EDN strings in the query parser.
* Export 'public' API from mentat_query_parser's top level.
* Stub out mentat::q_once.
2017-02-13 10:30:02 -08:00
Jordan Santell 4e81733eed Change expecteddatoms and expectedtransaction to their kebab-case counterparts, for valid EDN style. Fixes #270. r=nalexander (#287) 2017-02-11 12:06:09 -08:00
Jordan Santell 4f5c94891a Add octal, hexadecimal, and arbitrary base integers to the EDN parser. Fixes #277. r=rnewman (#286) 2017-02-10 16:03:35 -08:00
Jordan Santell 6ce5d526a3 Store a bitfield in temporary search tables and expand to bit flags in the datoms table to investigate performance difference. Fixes #226. r=nalexander (#242) 2017-02-10 12:03:49 -08:00
Joe Walker f591c90738 Use mentat-parser-utils in tx-parser. Fixes #235; r=rnewman,victorporof
Move macros query-parser/…/parser_utils.rs → parser-utils/…/query.rs

Signed-off-by: Joe Walker <jwalker@mozilla.com>
2017-02-10 18:30:03 +00:00
Jordan Santell 1deed24f42 Remove usage of global imports in db module. Fixes #251. r=nalexander (#253) 2017-02-10 09:09:13 -08:00
Victor Porof 49f91b05b0 Expose EDN into_ methods that consume the edn value, r=jwalker. Fixes 256
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-10 14:58:38 +01:00
Joe Walker cb40a0f581 Expose EDN as_ methods that return copied values, not references; r=ncalexan,jwalker 2017-02-10 12:09:13 +00:00
Richard Newman 8e2359d3ab Implement TypedValue::is_congruent_with and ::matches_type. r=jsantell 2017-02-09 18:45:50 -08:00
Richard Newman b56b7c2a3f ValueType is Copy. r=jsantell 2017-02-09 18:45:46 -08:00
Richard Newman fc73bfce75 Implement NonIntegerConstant::into_typed_value. r=jsantell 2017-02-09 18:45:46 -08:00
Richard Newman 1aa33423dc Derive PartialOrd and Ord for Variable. r=jsantell 2017-02-09 18:45:36 -08:00
Richard Newman 1122960462 Re-export NamespacedKeyword and PlainSymbol out of query. r=jsantell 2017-02-09 18:45:30 -08:00
Victor Porof 9be487ca7d Run pragmas to configure SQLite store and connection when we open a DB, r=ncalexan (#275)
Signed-off-by: Victor Porof <victor.porof@gmail.com>
2017-02-09 21:23:04 +01:00
Richard Newman 4366f6d61f Expose EDN as_ methods that return copied values, not references. 2017-02-09 10:21:35 -08:00
Victor Porof 42580539b8 Properly handle whitespace for Infinity and NaN, r=rnewman (#246)
Signed-off-by: Victor Porof <vporof@mozilla.com>
2017-02-09 18:13:44 +01:00
Richard Newman 7db74953d6 mentat_core doesn't need rusqlite. r=nalexander 2017-02-08 17:34:17 -08:00