Packages

  • package root

    Documentation/API for the Molecule library - a meta DSL for the Datomic database.

    scalamolecule.org | Github | Forum

    Definition Classes
    root
  • package molecule

    Molecule library - a Scala meta-DSL for the Datomic database.

    Molecule library - a Scala meta-DSL for the Datomic database.

    Definition Classes
    root
  • package core
    Definition Classes
    molecule
  • package api
    Definition Classes
    core
  • package exception
    Definition Classes
    api
  • package get

    Synchronous getter methods to retrieve data from Datomic.

    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
    • 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).

    Definition Classes
    api
    See also

    equivalent asynchronous getters in the getAsync package.

  • package getAsync

    Asynchronous getter methods to retrieve data from Datomic.

    Asynchronous getter methods to retrieve data from Datomic.

    For convenience, all synchronous getter methods from the get package are here wrapped in Futures.

    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 asynchronous getters, each returning Futures of data in various formats:

    • GetAsyncArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetAsyncIterable - for lazily traversing row by row
    • GetAsyncList - default getter returning Lists of tuples. Convenient typed data, suitable for smaller data sets
    • GetAsyncRaw - fastest retrieved raw un-typed data from Datomic

    Getters in each of the 5 groups come with 5 time-dependent variations:

    • getAsync [current data]
    • getAsyncAsOf
    • getAsyncSince
    • getAsyncWith
    • getAsyncHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent synchronous getters in the get package.

  • Keywords
  • Molecule
  • OptionalMapOps
  • ShowInspect
  • TxBundles
  • TxFunctions
t

molecule.core.api

TxBundles

trait TxBundles extends AnyRef

Source
TxBundles.scala
Linear Supertypes
AnyRef, Any
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. TxBundles
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def inspectTransactBundle(stmtss: Seq[Seq[Statement]]*)(implicit conn: Conn): Unit

    Inspect transaction bundle statements

    Add transaction statements from one or more molecule actions to inspectTransact to see the bundled transaction statements.

    Inspect transaction bundle statements

    Add transaction statements from one or more molecule actions to inspectTransact to see the bundled transaction statements.

    inspectTransact(
      // retract
      e1.getRetractTx,
      // save
      Ns.int(4).getSaveTx,
      // insert
      Ns.int.getInsertTx(List(5, 6)),
      // update
      Ns(e2).int(20).getUpdateTx
    )
    
    // Prints transaction data to output:
    /*
      ## 1 ## TxReport
      ========================================================================
      1          ArrayBuffer(
        1          List(
          1          :db/retractEntity   17592186045445)
        2          List(
          1          :db/add       #db/id[:db.part/user -1000247]     :Ns/int          4           Card(1))
        3          List(
          1          :db/add       #db/id[:db.part/user -1000252]     :Ns/int          5           Card(1))
        4          List(
          1          :db/add       #db/id[:db.part/user -1000253]     :Ns/int          6           Card(1))
        5          List(
          1          :db/add       17592186045446                     :Ns/int          20          Card(1)))
      ------------------------------------------------
      2          List(
        1    1     added: true ,   t: 13194139534345,   e: 13194139534345,   a: 50,   v: Wed Nov 14 23:38:15 CET 2018
    
        2    2     added: false,  -t: 13194139534345,  -e: 17592186045445,  -a: 64,  -v: 1
    
        3    3     added: true ,   t: 13194139534345,   e: 17592186045450,   a: 64,   v: 4
    
        4    4     added: true ,   t: 13194139534345,   e: 17592186045451,   a: 64,   v: 5
    
        5    5     added: true ,   t: 13194139534345,   e: 17592186045452,   a: 64,   v: 6
    
        6    6     added: true ,   t: 13194139534345,   e: 17592186045446,   a: 64,   v: 20
             7     added: false,  -t: 13194139534345,  -e: 17592186045446,  -a: 64,  -v: 2)
      ========================================================================
    */
    stmtss

    Statement's from multiple molecule operations

    conn

    Implicit Conn value in scope

  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. def transactBundle(stmtss: Seq[Seq[Statement]]*)(implicit conn: Conn): TxReport

    Transact bundled transaction statements

    Supply transaction statements of one or more molecule actions to perform a single atomic transaction.

    Transact bundled transaction statements

    Supply transaction statements of one or more molecule actions to perform a single atomic transaction.

    transact(
      // retract entity
      e1.getRetractTx,
      // save new entity
      Ns.int(4).getSaveTx,
      // insert multiple new entities
      Ns.int.getInsertTx(List(5, 6)),
      // update entity
      Ns(e2).int(20).getUpdateTx
    )
    stmtss

    Statement's from multiple molecule operations

    conn

    Implicit Conn value in scope

    returns

    TxReport with result of transaction

  19. def transactBundleAsync(stmtss: Seq[Seq[Statement]]*)(implicit conn: Conn, ec: ExecutionContext): Future[TxReport]

    Asynchronously transact bundled transaction statements

    Asynchronously transact bundled transaction statements

    Supply transaction statements of one or more molecule actions to asynchronously transact a single atomic transaction.

    Await.result(
      transactAsync(
        e1.getRetractTx,
        Ns.int(4).getSaveTx,
        Ns.int.getInsertTx(List(5, 6)),
        Ns(e2).int(20).getUpdateTx
      ) map { bundleTx =>
        Ns.int.getAsync map { queryResult =>
          queryResult === List(3, 4, 5, 6, 20)
        }
      },
      2.seconds
    )
    stmtss

    Statement's from multiple molecule operations

    conn

    Implicit Conn value in scope

    returns

    Future with TxReport with result of transaction

  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

bundled

Ungrouped