Code Monkey home page Code Monkey logo

clarango's Introduction

Clarango: a Clojure driver for ArangoDB

Clarango is a library to connect Clojure with the database ArangoDB. Although it is work in progress, the parts which are already there are stable.

The latest version of Clarango on Clojars is 0.7.1.

The compatibility is as follows:

  • 0.7.1 is compatible with ArangoDB versions 2.6 to 2.8 (and possibly higher; latest test was with version 2.8.11).
  • 0.6.0 is compatible with ArangoDB 2.3 and 2.4 (ArangoDB 2.5 is untested; to see what changed with version 0.6, check out this blog post).
  • 0.5.0 is compatible with ArangoDB versions 1.4 to 2.2.

Features

  • various options for connecting
  • document CRUD including various options
  • querying by example
  • AQL queries & custom functions
  • collection management
  • database management
  • graph functions
  • managing indices
  • transactions
  • experimental clojure idiomatic collection methods like cla-assoc! and cla-conj!
  • simple exception handling

Documentation

For an overview of the features and how to use see below. For more detailed documentation have a look at:

Installation

The driver is hosted on Clojars. Add this Leiningen dependency to your project.clj:

[clarango "0.7.1"]

Then require the lib in your clojure file. For example:

(:require [clarango.core :as clacore]
          [clarango.document :as document]
          [clarango.collection :as collection]
          [clarango.graph :as graph])

Setting the Connection

;; connect to localhost and default port 8529
(clacore/set-connection!)

;; pass a connection map
(clacore/set-connection!
  {
    :connection-url "http://localhost:8529/"
    :db-name "my-db"
    :collection-name "my-collection"
    ; if you are working with graphs you can optionally add :graph-name "my-graph"
  })

;; change default db
(clacore/set-default-db! "my-db")

;; ... or just
(clacore/with-connection {:connection-url "http://localhost:8529/" ...}
  ;; ... do your business here
  )

The server url is mandatory. Default database and collection are optional.

Document CRUD

(collection/create "test-collection")
(with-collection "test-collection"
  ;; create
  (document/create-with-key {:description "some test document"} :test-doc)
  ;; read
  (document/get-by-key :test-doc)
  (document/get-by-example {:description "some test document"})
  ;; update
  (document/update-by-key {:additional "some additional info"} :test-doc)
  ;; delete
  (document/delete-by-key :test-doc))

Graph

(collection/create "people" {"type" 2})
(collection/create "content" {"type" 2})
(graph/create :test-graph [{:edge-collection "my-test-edges" :from [:people] :to [:content]}])
(with-graph :test-graph
  (graph/create-vertex {:name "Rich Hickey"} :people))

All methods will use the default database and collection unless the names of different ones are passed as optional arguments. For a complete list of methods see the API overview

Bugs / Contributors

If you find bugs or are missing a feature open an issue or feel free to pull request. Furthermore we have easy and hard open issues. So if you like to help us, contact us or / and pick an issue. Also check out contributions.md.

We are looking for contributors to keep the project running, so please get in touch or just pull!

License

Licensed under the Apache Public License 2.0.

clarango's People

Contributors

lepetere avatar edlich avatar mikeholmesuk avatar tongqqiu avatar boorad avatar ruhibloodworth avatar the-alchemist avatar mikub avatar

Watchers

James Cloos avatar Pablo Botelho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.