- New parser for query and rules
- Added a lot of meaningful error messages and validations to query parser
- Support for _ (ignore binding) in
:inandfn-clausebindings - Fixed id allocation bug when nested maps are used for referenced entities (issue #59)
- Fixed squuids omitting leading zeros (issue #60)
- Fixed a bug when cross-referencing components caused infinite loop in Pull API (isuue #58, pull request #61)
- Pull API handles recursion more like Datomic does (issue #62)
- Exposed DB filter API to js (pull request #65)
- Added ICounted, ISequable, IEmptyableCollection to
datascript.core/DB - Force put
DatomandDBtag readers tocljs.reader/*tag-table*, do not rely ondata_readers.clj
- Lookup refs can be inlined in query
:wherepatterns (issue #53) - Pull API (issue #37, pull request #51) by David Thomas Hume
pullform in:findclause
:db/uniqueconstraints- Upserts
- Lookup refs
entidfunction
- Find specifications: collection
:find [?e ...], tuple:find [?e ?v], and scalar:find ?e . - Support for
:db/isComponent(issue #3) - Support for nested maps in
transact!(also fixes #38) - [ BREAKING ] Custom aggregate fns must be called via special syntax (
aggregatekeyword):(q '[:find (aggregate ?myfn ?e) :in $ ?myfn ...]). Built-in aggregates work as before:(q '[:find (count ?e) ...] - Return nil from
entitywhen passed nil eid (issue #47) - Transaction data is now validated, with proper error messages (also fixes #48)
- Fixed a bug with function call after function relation was filtered out (issue #44)
- Fixed a bug when emtpy coll in input was not creating empty relation
- BTSet and its slices (returned by
datoms/seek-datoms/index-rangecalls) now support fast reverse iteration viareverse. (datascript/datom e a v & [tx added])call for creating new datoms- Added missing aggregate funs:
avg,median,variance,stddevandcount-distinct(issue #42, thx @montyxcantsin) minandmaxaggregates use comparator instead of default js<comparison- Fixed a bug when fn inside a query on empty relation returned non-empty result
- Filtered DB support via
filter
- [ BREAKING ] Entity ids and transaction ids now have to be numbers, attributes can only be keywords (strings if used from JS)
- New method
init-dbfor fast creation of DB from existing datoms (useful for e.g. initialization from serialized state) - Improved performance of
transact!(~20%) and initial database population (init-db,db-from-reader, ~800%)
- Externs provided via
deps.cljs— no need to manually specify externs when using datascript dependency
- Ability to pass inputs (predicates/functions bindings) down to rules (issues #28 #29)
- Javascript version is now packaged as a proper CommonJS/RequireJS module (include via script tag still supported) (issue #39)
- Published to npm: npmjs.org/package/datascript
- [ BREAKING ] Javascript namespace is renamed from
datascript.jstodatascript
- Reference transaction id inside transaction by using
:db/current-txinstead of entity id (issue #32) - You can get id of transaction from
TxReport:(get-in tx-report [:tempids :db/current-tx]) - Ability to pass arbitrary metadata along with transaction (third argument to
transact!) and read it in listener callback (:tx-metakey ofTxReport) (issue #32)
- Added
:db.fn/castransaction function (issue #20, thx @montyxcantsin) - Added
get-some,get-else,misssing?query functions (issue #21, thx @montyxcantsin) - Fixed
touchbreaking entity cache (issue #17) - Added
groundfn (issue #25) - Fixed query predicate/fn calls without free variables
- Retract incoming entity references on
:db.fn/retractEntity(issue #18) - You can now use reverse relation name when transacting entity as a map
Cosmetic changes to better mimic Datomic API. Useful for sharing code between Datomic and DataScript:
- Added
tempid,resolve-tempid,db,transact,transact-async,index-range,squuid,squuid-time-millis - [ BREAKING ] renamed
transacttowith,withtodb-with
- Optimized speed of DB’s
equivandhash, Datom’shash - Entity’s
touchcall accessible throughdatascriptnamespace - Accept sets in entity maps as values for
:db.cardinality/manyattributes
Proper entities implementation:
- Entities are now lazy and implement usual Map protocols
- [ BREAKING ] When accessing attribute of
:db/valueType :db.type/ref, its value will be automatically expanded to entites, allowing for recursive exploration of entities graphs (e.g.(-> (d/entity db 42) :parent :parent :children)) - Entities support backwards navigation (e.g.
(:person/_friends (d/entity db 42)))
- Externs file now can be referred as
:externs [datascript/externs.js"]
Big performance improvements:
- New B-tree based indexes
- New set-at-a-time, hash-join powered query and rules engine
- Queries now up to 10× times faster
- You can specify DB for rule call (like
($db follows ?e1 ?e2)) - Datoms are required to have integer id and keyword attributes, but no restriction on types of values
- Clojure reader support (pr/read) for DB and Datom
datomsandseek-datomsAPI calls- referencing other entities’ tempids in transaction data (issue #10)
- Transactor functions via
:db.fn/call(thx @thegeez) - Vanilla JS API bindings
- [ BREAKING ] Schema keywords namespaced on a par with Datomic schema
entityadded