CrossClj

0.3.1 docs

SourceDocs



RECENT

    facjure/atomic

    Clojars

    Feb 20, 2016


    OWNER
    Facjure
    San Francisco, CA
    priyatam@facjure.com
    www.facjure.com

    Readme

    Index of all namespaces


    « Project + dependencies

    A thin wrapper on Datomic

    The README below is fetched from the published project artifact. Some relative links may be broken.

    Atomic

    A tiny library on Datomic, with a declarative api for working with Facts, Schemas, and Rules.

    Getting Started

    For in-memory datomic, setup:

    (db/connect-anonymously!)
    

    Create a schema:

    (schema/create
      [[:story/title "full title" :string :one :fulltext :index]
      [:story/url "story's permamnent url" :string :one :unique-identity :index]
      [:story/slug "a short title" :string :one]
      [:comments "a collection of comments" :ref :many :component]
      [:comment/body "comment 140 chars or less" :string :one]
      [:comment/author "comment author" :ref :one]])
    

    Validate:

    (schema/has-attribute? :story/title)
    

    Create Facts:

    (fact/add
      {:story/title "Datomic's 1.0 is released"
       :story/url "http://datomic.com/downloads/1.0"
       :story/slug "New, improved declarative api"
       :comment/author 17592186045425
       :comment/body "This is great!"})
    

    Find Facts:

    (query/find-all-by :story/title)
    (query/find-changes 17592186045425)
    >> {:author/name {:old nil, :new "Stu G"}, :author/email {:old nil, :new "stu@somemail.com"}}
    (query/find-all-by :story/title)
    (query/find [:story/title] :story/url "http://datomic.com/downloads/1.0")
    

    Queries:

    (query/defquery
      '{:find [?title ?url]
        :in   [$ ?title]
        :where [[?a :story/title ?title]
               [?t :story/url ?url]]
        :values ["Clojure 2.0 announced", "http://clojure.org/downloads/2.0-beta"]})
    

    Status

    Atomic is currently in the design phase.

    Clojars Project

    Circle CI

    License

    © 2015-2016 Facjure, LLC.

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