trait TxFunctions extends AnyRef
Transactional methods for bundled transactions and tx functions
- Source
- TxFunctions.scala
- Grouped
- Alphabetic
- By Inheritance
- TxFunctions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
macro
def
inspectTransactFn(txFnCall: Seq[Seq[Statement]], txMolecules: Molecule*): 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.// Print inspect info for tx function invocation inspectTransact(transfer(fromAccount, toAccount, 20)) // 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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
macro
def
transactFn(txFnCall: Seq[Seq[Statement]], txMolecules: Molecule*): TxReport
Transact tx function invocation
Macro that takes a tx function invocation itself as its argument.Transact tx function invocation
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 is transacted as one atomic transaction.val txReport = transact(transfer(fromAccount, toAccount, 20))
Transaction meta data molecules can be added
// Add tx meta data that John did the transfer and that it is a scheduled transfer transact( transfer(fromAccount, toAccount, 20), Person.name("John"), UseCase.name("Scheduled transfer")) // Query multiple Tx meta data molecules Account(fromAccount).balance .Tx(Person.name_("John")) .Tx(UseCase.name_("Scheduled transfer")).get.head === 80 Account(toAccount).balance .Tx(Person.name_("John")) .Tx(UseCase.name_("Scheduled transfer")).get.head === 720
- txFnCall
Tx function invocation
- txMolecules
Optional tx meta data molecules
- returns
TxReport with result of transaction
-
macro
def
transactFnAsync(txFnCall: Seq[Seq[Statement]], txMolecules: Molecule*): Future[TxReport]
Asynchronously transact tx function invocation
Macro that takes a tx function invocation itself as its argument.Asynchronously transact tx function invocation
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 is asynchronously transacted as one atomic transaction using Datomic's asynchronous API.Await.result( transactAsync(transfer(fromAccount, toAccount, 20)) map { txReport => Account(fromAccount).balance.get.head === 80 // (could be asynchronous too) Account(toAccount).balance.get.head === 720 }, 2.seconds )
Additional transaction meta data can be added
Await.result( transactAsync( transfer(fromAccount, toAccount, 20), Person.name("John"), UseCase.name("Scheduled transfer")) map { txReport => Account(fromAccount).balance .Tx(Person.name_("John")) .Tx(UseCase.name_("Scheduled transfer")) .get.head === 80 // (could be asynchronous too) }, 2.seconds )- txFnCall
Tx function invocation
- txMolecules
Optional tx meta data molecules
- returns
Future with TxReport with result of transaction
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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.

Documentation/API for the Molecule library - a meta DSL for the Datomic database.
scalamolecule.org | Github | Forum