Skip to content
Kristian Mandrup edited this page Feb 27, 2016 · 14 revisions

Here an overview of the Datascript API exported for use from Javascript.

- becomes _. Special characters such as ? and ! are munged such that assoc! is compiled to assoc_BANG_ and so on...

user=> (munge "assoc!")
"assoc_BANG_"

cljs.user=> (munge "q?")
"q_QMARK_"

core

js public API

datascript.core

q // dq/q
entity // de/entity
entity_db(entity)

datom // db/datom

pull dp/pull)
pull_many dp/pull-many
touch de/touch

empty_db // db/empty-db
init_db // db/init-db

datom_QMARK_ // db/datom?
db_QMARK_ // db/db?
tx0 // db/tx0
filter(db pred)
with(db tx-data tx-meta)
db_with(db tx-data)
datoms(db index c1 c2 c3 c4])
seek_datoms(db index c1 c2 c3 c4)

index_range(db attr start end)
entid // db/entid

conn_QMARK_(conn)
conn_from_db(db)
  (atom db :meta { :listeners (atom {}) }))

conn_from_datoms(datoms schema)

create_conn(schema)

transact_BANG_(conn tx-data tx-meta)
reset_conn!(conn db tx-meta)
listen_BANG_(conn callback)
listen_BANG_(conn key callback)

unlisten_BANG_(conn key)
tempid(part x)
resolve_tempid(_db tempids tempid)

db(conn)

transact(conn tx-data tx-meta)

transact_async()
squuid(msec)
squuid_time_millis(uuid)
Clone this wiki locally