-
-
Notifications
You must be signed in to change notification settings - Fork 311
Javascript API
Kristian Mandrup edited this page Feb 27, 2016
·
14 revisions
Here an overview of the Datascript API exported for use from Javascript.
DataScript has a dedicated JS api, it’s better to use it. Here’s a lot of examples: js tests
empty_db(schema)
init_db(datoms..., schema)
q(query, sources)
pull(db pattern eid)
pull_many(db, pattern, eids)
db_with(db, entities)
entity(db, eid)
touch // d/touch
entity_db // d/entity-db
filter((db, pred)
is_filtered // d/is-filtered
create_conn(schema)
conn_from_db(db)
conn_from_datoms(datoms, schema)
db(conn)
transact(conn, entities..., tx-meta)
reset_conn(conn, db, tx-meta)
listen(conn, callback)
unlisten(conn, key)
resolve_tempid(tempids, tempid)
datoms(db, index, components)
seek_datoms(db, index, components)
index_range(db, attr, start end)
squuid()
squuid_time_millis(uuid)
You can also use public core API directly, however this is NOT recommended.
q // dq/q
entity(db eid)
entity_db(entity)
datom(e, a, v, tx, added)
pull(db, selector, eid)
pull_many(db, selector, eids)
touch de/touch
empty_db(schema)
init_db(datoms, schema)
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)
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)