Packages

trait TxFunctions extends AnyRef

Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. TxFunctions
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): 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[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. macro def inspectTransactFn(txFnCall: Future[Seq[Statement]], txMolecules: Molecule*)(implicit conn: Future[Conn], ec: ExecutionContext): Future[Unit]

    Inspect tx function invocation

    Print transaction statements to output of a tx function invocation without affecting the live database.

    Inspect tx function invocation

    Print transaction statements to output of a tx function invocation without affecting the live database.

    for {
      // Print inspect info for tx function invocation
      _ <- inspectTransact(transfer(fromAccount, toAccount, 20))
    } yield ()
    
    // Prints produced tx statements to output:
    /*
    ## 1 ## TxReport
    ========================================================================
    1          ArrayBuffer(
      1          List(
        1          :db/add       17592186045445       :Account/balance    80        Card(1))
      2          List(
        1          :db/add       17592186045447       :Account/balance    720       Card(1)))
    ------------------------------------------------
    2          List(
      1    1     added: true ,   t: 13194139534345,   e: 13194139534345,   a: 50,   v: Thu Nov 22 16:23:09 CET 2018
    
      2    2     added: true ,   t: 13194139534345,   e: 17592186045445,   a: 64,   v: 80
           3     added: false,  -t: 13194139534345,  -e: 17592186045445,  -a: 64,  -v: 100
    
      3    4     added: true ,   t: 13194139534345,   e: 17592186045447,   a: 64,   v: 720
           5     added: false,  -t: 13194139534345,  -e: 17592186045447,  -a: 64,  -v: 700)
    ========================================================================
    */
    txFnCall

    Tx function invocation

    txMolecules

    Optional tx meta data molecules

  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. macro def transactFn(txFnCall: Future[Seq[Statement]], txMolecules: Molecule*)(implicit conn: Future[Conn], ec: ExecutionContext): Future[TxReport]

    Invoke tx function

    Macro that takes a tx function invocation itself as its argument.

    Invoke tx function

    Macro that takes a tx function invocation itself as its argument. The tx function is analyzed by the macro and the necessary transaction preparations done at compile time.

    At runtime, the returned statements from the tx function transacted as one atomic transaction using Datomic's asynchronous API.

    for {
      // Transact transfer
      _ <- transactFn(
        transfer(fromAccount, toAccount, 20)
      )
    
      // Amount has been transferred safely
      _ <- Account(fromAccount).balance.get.map(_.head ==> 80)
      _ <- Account(toAccount).balance.get.map(_.head ==> 720)
    } yield ()

    Additional transaction meta data can be added

    for {
      _ <- transactFn(
        transfer(fromAccount, toAccount, 20),
    
        // Tx meta data that John made the transfer
        Person.name("John"),
    
        // Tx meta data that the transfer was part of use case "Scheduled transfer)
        UseCase.name("Scheduled transfer")
      )
    
      _ <- Account(fromAccount).balance
        .Tx(Person.name_("John") + UseCase.name_("Scheduled transfer"))
        .get.map(_.head ==> 80)
    } yield ()
    txFnCall

    Tx function invocation

    txMolecules

    Optional tx meta data molecules

    returns

    Future with TxReport with result of transaction

  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Transaction functions

Atomic transaction logic with access to tx database value.

Ungrouped