Code Monkey home page Code Monkey logo

fleetdb-client's Introduction

fleetdb-client

A Clojure client library for FleetDB.

Installation

First, download and start FleetDB as described in the FleetDB getting started guide.

If you want to incorporate this client into a project managed by Maven or Leiningen, you can find the necessary Maven artifact information on the client's Clojars project page.

Usage

Using the library is simple:

(use 'fleetdb.client)
(def client (connect))

(query client ["ping"])
=> "pong"

(query client ["select" "accounts" {"where" ["=" "id" 2]}])
=> [{"id" 2 "owner" "Alice" "credits" 150}]

Keywords can be used in queries, as they are converted to strings before being sent to the server:

(query client [:select :accounts {:where [:= :id 2]}])
=> [{"id" 2 "owner" "Alice" "credits" 150}]

The client can also be used as a function that executes the given query:

(client [:ping])

The client will raise an exception in the case of an error:

(client ["bogus"])
java.lang.Exception: Malformed query: unrecognized query type '"bogus"'

You can optionally specify a host and port other than the default "127.0.0.1" and 3400:

(def client (connect {:host "68.127.150.103" :port 3401}))

License

Copyright 2009 Mark McGranaghan and released under an MIT license.

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.