Skip to content

jamesaddinall/refdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

refdb

A Clojure library designed to utilise a clojure Ref, and the filesytem as a simple "database".

Artifacts

cljs-time artifacts are released to Clojars.

If you are using Maven, add the following repository definition to your pom.xml:

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>

The Most Recent Release

With Leiningen:

[com.andrewmcveigh/refdb "0.1.0"]

With Maven:

<dependency>
  <groupId>com.andrewmcveigh</groupId>
  <artifactId>refdb</artifactId>
  <version>0.1.0</version>
</dependency>

Usage

Refdb needs to know where it can find it's files. It gets this from #'refdb.core/*path*.

Helpers #'refdb.core/with-refdb-path and #'refdb.core/wrap-refdb can be used to set the path in a flexible way.

> (with-refdb-path "/path/to/files"

>   (def collection (ref nil))

>   (init! collection) ; call in initialisation

>   (destroy! collection)

>   (save! collection {:key val ...})

>   (save! collection assoc-in [0 :key1] {:key val ...})

>   (save! collection update-in [0 :key2] inc)

> )

License

Copyright © 2013 Andrew Mcveigh

Distributed under the Eclipse Public License, the same as Clojure.

About

File-backed ref-based "database"

Resources

Stars

Watchers

Forks

Packages

No packages published