Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

hraberg/datascript-mapdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datascript-mapdb

Datascript backed by MapDB, based on an idea by Ernestas Lisauskas.

Experimental, uses with-redefs to monkey-patch Datascript and replace its in-memory B+ tree implementation. Not tested except for the most trivial cases, performance unknown.

Usage

  ;; Taken from https://github.com/tonsky/datascript
  (with-mapdb [mapdb (new-mapdb-file "test-db")]
    (let [schema {:aka {:db/cardinality :db.cardinality/many}}
          conn   (create-mapdb-conn mapdb schema)]
      (d/transact! conn [{ :db/id -1
                          :name  "Maksim"
                          :age   45
                          :aka   ["Maks Otto von Stirlitz", "Jack Ryan"] } ])
      (d/q '[ :find  ?n ?a
             :where [?e :aka "Maks Otto von Stirlitz"]
             [?e :name ?n]
             [?e :age  ?a] ]
             @conn)))

References

License

Copyright © 2016 Håkan Råberg

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Datascript backed by MapDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published