DataScript class
Properties
connections
→ List
Returns connections ids.
no setter
context
↔ JsContext
getter/setter pair
databases
→ List
Returns database ids.
no setter
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
connFromDatoms (dynamic dataoms , {Schema ? schema })
→ JsRef
Creates an empty JsRef and a mutable reference to it. See createConn .
connFromDb (JsRef db )
→ JsRef
Creates a mutable reference to a given immutable database.
See createConn .
createConn ({Schema ? schema })
→ JsRef
Creates a mutable reference (a “connection”) to an empty immutable
database inside JsRuntime.
datoms (JsRef db , String index , Object ? c1 , Object ? c2 , Object ? c3 , Object ? c4 )
→ dynamic
Index lookup. Returns a sequence of datoms (lazy iterator over actual Db
index) which components (e, a, v) match passed arguments.
db (JsRef conn )
→ JsRef
Creates the underlying immutable database from a connection.
dbWith (JsRef db , List entities )
→ Future <JsRef >
Applies transaction to an immutable db value, returning new immutable db
value. Same as (:db-after (with db tx-data))
.
emptyDb ({Schema ? schema })
→ JsRef
Creates an empty database with an optional schema.
entity (JsRef db , dynamic eid )
→ Entity
Retrieves an entity by its id from database. Entities are lazy map-like
structures to navigate DataScript database content.
entityDb (Entity e )
→ JsRef
Returns a db that entity was created from.
filter (dynamic db , dynamic pred )
→ Future
Returns a view over database that has same interface but only includes
datoms for which the (pred db datom)
is true. Can be applied multiple
times.
fromSerializable (dynamic serializable , dynamic opts )
→ Future
Creates db from a data structure (not string!) produced by serializable.
indexRange (JsRef db , dynamic attr , dynamic start , dynamic end )
→ Future
Returns part of :avet
index between [_ attr start]
and [_ attr end]
in AVET sort order.
initDb (dynamic datoms , {Schema ? schema })
→ JsRef
Low-level fn for creating database quickly from a trusted sequence of
datoms.
isFiltered (JsRef db )
→ Future <bool >
Returns true
if this database was filtered using [filter ], false
otherwise."
listen (JsRef conn , String key , void callback (dynamic ) )
→ dynamic
Listen for changes on the given connection.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pull (JsRef db , dynamic pattern , dynamic lookup )
→ Future
Fetches data from database using recursive declarative description.
See docs.datomic.com/on-prem/pull.html .
pullMany (JsRef db , dynamic pattern , List lookup )
→ Future
Same as pull , but accepts sequence of ids and returns sequence of maps.
q (String query , List inputs )
→ Future
Executes a datalog query. See docs.datomic.com/on-prem/query.html
resetConn (JsRef conn , JsRef db , {dynamic txMeta })
→ dynamic
Forces underlying conn
value to become db
.
Will generate a TxReport
that will remove everything from old value
and insert everything from the new one."
resolveTempid (Map tempids , dynamic tempid )
→ dynamic
Does a lookup in tempids map, returning an entity id that tempid was
resolved to.
seekDatoms (dynamic db , dynamic index , Object ? c1 , Object ? c2 , Object ? c3 , Object ? c4 )
→ dynamic
Similar to [datoms ], but will return datoms starting from specified
components and including rest of the database until the end of the index.
serializable (dynamic db , Object ? opts )
→ Future
Converts db into a data structure (not string!) that can be fed to serializer
of your choice (e.g. js/JSON.stringify
in CLJS, cheshire.core/generate-string
or jsonista.core/write-value-as-string
in CLJ).
squuid ({int ? msec })
→ Future <String >
Generates a UUID that grow with time. Such UUIDs will always go to the
end of the index and that will minimize insertions in the middle.
squuidTimeMillis (dynamic uuid )
→ Future <int >
Returns time that was used in [squuid ] call, in milliseconds, rounded
to the closest second.
toString ()
→ String
A string representation of this object.
inherited
touch (Entity e )
→ List
Forces all entity attributes to be eagerly fetched and cached. Only usable for debug output.
transact (JsRef conn , List txData , {dynamic txMeta })
→ Future <TxReport >
Applies transaction the underlying database value and atomically updates
connection reference to point to the result of that transaction, new db
value.
unListen (JsRef conn , String key )
→ dynamic
Removes registered listener from connection. See also [listen! ].
flutter_js_datascript 0.2.0