package get
Synchronous getter methods to retrieve data from Datomic.
The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.
The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.
Molecule has 5 groups of synchronous getters, each returning data in various formats:
- GetArray - fastest retrieved typed data set. Can be traversed with a fast
while
loop - GetIterable - for lazily traversing row by row
- GetJson - data formatted as Json string
- GetList - default getter returning Lists of tuples. Convenient typed data, suitable for smaller data sets
- GetRaw - fastest retrieved raw un-typed data from Datomic
Getters in each of the 5 groups come with 5 time-dependent variations:
- get [current data]
- getAsOf
- getSince
- getWith
- getHistory
Each time variation has various overloads taking different parameters (see each group for more info).
- Source
- package.scala
- See also
equivalent asynchronous getters in the getAsync package.
Type Members
- trait GetArray[Tpl] extends AnyRef
Data getter methods on molecules returning
Array[Tpl]
.Data getter methods on molecules returning
Array[Tpl]
.
The fastest way of getting a large typed data set. Can then be traversed with a fastwhile
loop. - trait GetIterable[Tpl] extends AnyRef
Data getter methods on molecules that return Iterable[Tpl].
Data getter methods on molecules that return Iterable[Tpl].
Suitable for data sets that are lazily consumed. - trait GetJson extends AnyRef
Data getter methods on molecules that return a Json String.
Data getter methods on molecules that return a Json String.
Molecule builds a Json String directly from the untyped raw Datomic data.
Attributes names are used as Json field names. In order to distinguish fields from each other, all attribute names are prepended with the namespace name (in lowercase). For a namespacePerson
with an attributename
we get:- "person.name"
To distinguis fields of multiple relationships to the same namespace like
friends
andenemies
pointing to otherPerson
's require us to add a relationship name prefix too:- "friends.person.name"
- "enemies.person.name"
Furthermore, if the attribute is part of a transaction meta-data molecule, we prefix that with
tx
too:- "tx.person.name"
- "tx.friends.person.name"
- See also
- trait GetList[Tpl] extends GetArray[Tpl]
Default data getter methods on molecules that return List[Tpl].
Default data getter methods on molecules that return List[Tpl].
For expected smaller result sets it's convenient to return Lists of tuples of data. Considered as the default getter, no postfix has been added (get
instead ofgetList
). - trait GetRaw extends AnyRef
Data getter methods on molecules that return raw untyped Datomic data.
Data getter methods on molecules that return raw untyped Datomic data.
Returns raw untypedjava.util.Collection[java.util.List[Object]]
directly from Datomic and is therefore the fastest (but untyped) way of retrieving data. Can be useful where typed data is not needed.
Documentation/API for the Molecule library - a meta DSL for the Datomic database.
Manual | scalamolecule.org | Github | Forum