trait DatomicEntity extends AnyRef
- Grouped
- Alphabetic
- By Inheritance
- DatomicEntity
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def apply(attr1: String, attr2: String, moreAttrs: String*)(implicit ec: ExecutionContext): Future[List[Option[Any]]]
- abstract def apply[T](attr: String)(implicit ec: ExecutionContext): Future[Option[T]]
- abstract def attrs(implicit ec: ExecutionContext): Future[List[String]]
-
abstract
def
getRetractStmts(txMeta1: Molecule, txMetaMore: Molecule*)(implicit ec: ExecutionContext): Future[Seq[Statement]]
Get entity retraction transaction data without affecting the database.
Get entity retraction transaction data without affecting the database.
CallgetRetractStmtsto retrieve the generated transaction data of the methodretracton an entityfor { // Get entity id of Ben benId <- Person.e.name_("Ben").get.map(_.eid) // Retraction transaction data _ <- benId.getRetractStmts().map(_ ==> List( RetractEntity(17592186045453) )) } yield ()
- txMeta1
tx meta data molecule
- txMetaMore
Optional additional tx meta data molecules
- ec
Implicit scala.concurrent.ExecutionContext
- returns
Future[Seq[Statement]]
-
abstract
def
getRetractStmts(implicit ec: ExecutionContext): Future[Seq[Statement]]
Get entity retraction transaction data without affecting the database.
Get entity retraction transaction data without affecting the database.
CallgetRetractStmtsto retrieve the generated transaction data of the methodretracton an entityfor { // Get entity id of Ben benId <- Person.e.name_("Ben").get.map(_.eid) // Retraction transaction data _ <- benId.getRetractStmts.map(_ ==> List(RetractEntity(17592186045453))) } yield ()
- ec
Implicit scala.concurrent.ExecutionContext
- returns
Future[Seq[Statement]]
-
abstract
def
graph(implicit ec: ExecutionContext): Future[Map[String, Any]]
Get entity graph as Map.
Get entity graph as Map.
If entity has reference(s) to other entities it can be a nested graph. Default max levels retrieved is 5.- Keys of returned Map are namespaced names of attributes
- Values of returned Map are untyped attribute values. For references to other entities, the value is a Map itself of the referenced entity attributes, etc.
for { benId <- Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").map(_.eid) _ <- benId.graph.map(_ ==-< Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> Map( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" )) } yield ()
- returns
Map[key: String, value: Any] where value can be a primitive or another nested Map of the entity graph
-
abstract
def
graphCode(maxDepth: Int)(implicit ec: ExecutionContext): Future[String]
Get entity graph as String with code for copy/paste into tests.
-
abstract
def
graphDepth(maxDepth: Int)(implicit ec: ExecutionContext): Future[Map[String, Any]]
Get entity graph to some depth as Map.
Get entity graph to some depth as Map.
- Keys of returned Map are namespaced names of attributes
- Values of returned Map are untyped attribute values. For references to other entities, the value is a Map itself of the referenced entity attributes, etc.
for { benId <- Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").map(_.eid) // 2 levels returned _ <- benId.graphDepth(2).map(_ ==> Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> Map( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" )) // 1 level returned _ <- benId.graphDepth(1).map(_ ==> Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> 17592186045446L // Only reference returned ":Person/name" -> "Ben" )) } yield ()
- returns
Map[key: String, value: Any] where value can be a primitive or another nested Map of the entity graph
-
abstract
def
inspectGraph(implicit ec: ExecutionContext): Future[Unit]
Print entity graph as Map-string (for presentation).
Print entity graph as Map-string (for presentation).
To show the entity graph, this method quotes all text strings so that you can paste the whole graph into any presentation.
If the entity has reference(s) to other entities it can be a nested graph. Default max levels retrieved is 5.- Keys of returned Map are namespaced names of attributes
- Values of returned Map are untyped attribute values. For references to other entities, the value is a Map itself of the referenced entity attributes, etc.
for { benId <- Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").map(_.eid) _ <- benId.graphCode.map(_ ==> """Map( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> Map( | ":db/id" -> 17592186045446L, | ":Address/street" -> "Hollywood Rd"), | ":Person/name" -> "Ben")""".stripMargin )) } yield ()
- returns
String
-
abstract
def
inspectGraphDepth(maxDepth: Int)(implicit ec: ExecutionContext): Future[Unit]
Print entity graph to some depth as Map-string (for presentation).
Print entity graph to some depth as Map-string (for presentation).
To show the entity graph, this method quotes all text strings so that you can paste the whole graph into any presentation.- Keys of returned Map are namespaced names of attributes
- Values of returned Map are untyped attribute values. For references to other entities, the value is a Map itself of the referenced entity attributes, etc.
for { benId <- Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").map(_.eid) // 2 levels (in this case all levels) returned _ <- benId.graphCodeDepth(2).map(_ ==> """Map( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> Map( | ":db/id" -> 17592186045446L, | ":Address/street" -> "Hollywood Rd"), | ":Person/name" -> "Ben")""".stripMargin )) // 1 level returned // Note that only reference to Address entity on level 2 is returned _ <- benId.graphCodeDepth(1).map(_ ==> """Map( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> 17592186045446L, | ":Person/name" -> "Ben")""".stripMargin )) } yield ()
- returns
String
-
abstract
def
inspectRetract(txMeta1: Molecule, txMetaMore: Molecule*)(implicit ec: ExecutionContext): Future[Unit]
Inspect entity transaction data of method
retractwith tx meta data without affecting the database.Inspect entity transaction data of method
retractwith tx meta data without affecting the database.for { // Inspect retraction of an entity _ <- eid.inspectRetract(Ref2.str2("meta2") + Ref1.str1("meta1")) } yield ()
This will print generated Datomic transaction statements in a readable format to output:
## 1 ## Inspect `retract` on entity with tx meta data ============================================================================= list( RetractEntity(17592186045453), Add(datomic.tx,:Ref2/str2,meta2,Card(1)), Add(datomic.tx,:Ref1/str1,meta1,Card(1))) =============================================================================
- txMeta1
tx meta data molecule
- txMetaMore
Optional additional tx meta data molecules
- ec
Implicit scala.concurrent.ExecutionContext
- returns
Unit (prints data to console)
-
abstract
def
inspectRetract(implicit ec: ExecutionContext): Future[Unit]
Inspect entity transaction data of method
retractwithout affecting the database.Inspect entity transaction data of method
retractwithout affecting the database.for { // Inspect retraction of an entity _ <- eid.inspectRetract } yield ()
This will print generated Datomic transaction statements in a readable format to output:
## 1 ## Inspect `retract` on entity ============================================================================= list( RetractEntity(17592186045453)) =============================================================================
- ec
Implicit scala.concurrent.ExecutionContext
- returns
Unit (prints data to console)
-
abstract
def
retract(txMeta1: Molecule, txMetaMore: Molecule*)(implicit ec: ExecutionContext): Future[TxReport]
Retract single entity using entity id and tx meta data.
Retract single entity using entity id and tx meta data.
Given the implicit conversion of Long's in molecule.datomic.base.api.EntityOps to an Entity we can can callretracton an entity id directly:for { eid <- Ns.int(1).save.map(_.eid) // Retract entity with tx meta data tx <- eid.retract(Ref2.str2("meta2"), Ref1.str1("meta1")).map(_.tx) // What was retracted and with what tx meta data _ <- Ns.e.int.tx.op_(false).Tx(Ref2.str2 + Ref1.str1).getHistory.map(_ ==> List( (eid, 1, tx, "meta2", "meta1") )) } yield ()
To retract single entity id with tx meta data, use
eid.Tx(MyMetaData.action("my meta data")).retract
To retract multiple entities (with or without tx meta data), use
retract(eids, txMetaDataMolecules*)in molecule.datomic.base.api.EntityOps.- txMeta1
tx meta data molecule
- txMetaMore
Optional additional tx meta data molecules
- ec
Implicit scala.concurrent.ExecutionContext
- returns
molecule.datomic.base.facade.TxReport with result of retraction
-
abstract
def
retract(implicit ec: ExecutionContext): Future[TxReport]
Retract single entity using entity id.
Retract single entity using entity id.
Given the implicit conversion of Long's in molecule.datomic.base.api.EntityOps to an Entity we can can callretracton an entity id directly:for { // Get entity id of Ben benId <- Person.e.name_("Ben").get.map(_.eid) // Retract Ben entity _ <- benId.retract _ <- Person.name.get.map(_ ==> Nil) } yield ()
To retract single entity id with tx meta data, use
eid.Tx(MyMetaData.action("my meta data")).retract
To retract multiple entities (with or without tx meta data), use
retract(eids, txMetaDataMolecules*)in molecule.datomic.base.api.EntityOps.- ec
Implicit scala.concurrent.ExecutionContext
- returns
molecule.datomic.base.facade.TxReport with result of retraction
Concrete 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()
-
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
-
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()

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