-
-
Notifications
You must be signed in to change notification settings - Fork 308
Javascript API
Kristian Mandrup edited this page Mar 8, 2016
·
14 revisions
Here an overview of the Datascript API exported for use from Javascript.
DataScript has a dedicated JS API.
Some examples:
datascript-mori contains some usage examples:
Database
db(conn)
init_db(datoms..., schema)
empty_db(schema)
db_with(db, entities)
entity_db(..)
Queries
q(query, sources)
pull(db, pattern, eid)
pull_many(db, pattern, eids)
entity(db, eid)
filter(db, pred)
Misc
touch(..)
is_filtered(..)
resolve_tempid(tempids, tempid)
index_range(db, attr, start end)
Connection
create_conn(schema)
conn_from_db(db)
conn_from_datoms(datoms, schema)
reset_conn(conn, db, tx-meta)
Transaction
transact(conn, entities..., tx-meta)
Listeners
listen(conn, callback)
unlisten(conn, key)
Datoms
datoms(db, index, components)
seek_datoms(db, index, components)
Unique IDs
squuid()
squuid_time_millis(uuid)