Skip to content

Datomic

Paula Gearon edited this page Oct 10, 2018 · 1 revision

Naga supports using a Datomic backend. This is currently only supported for Naga on the JVM.

Initializing

To initialize the Datomic module, include the following in the require section of your code:

[naga.storage.datomic.core]

It should not be necessary to refer to anything directly in this namespace, as everything is accessed with protocols from naga.store.

Data Model

Attributes in Datomic must be typed. This is handled internally, but it may occasionally be necessary to understand the model differences that this leads to.

The principle difference is in the :naga/first and :naga/contains properties that are used for array membership. Since any kind of value can appear in an array, these attributes require variants for each type. These attributes and their types are:

first attribute contains attribute type
:naga/first :naga/contains object
:naga/first-s :naga/contains-s string
:naga/first-l :naga/contains-l integer (long)
:naga/first-b :naga/contains-b boolean
:naga/first-c :naga/contains-c character
:naga/first-d :naga/contains-d date
:naga/first-uu :naga/contains-uu uuid
:naga/first-u :naga/contains-u uri

The object type refers to entities (or maps) and lists. This refers to the internal reference type in Datomic.

Clone this wiki locally