case class DatomicEntity_Peer(entity: Entity, conn: Conn_Peer, eid: Any, showKW: Boolean = true) extends DatomicEntity with Product with Serializable
Datomic Entity facade for peer api.
- conn
Implicit Conn in scope
- eid
Entity id of type Object
- Source
- DatomicEntity_Peer.scala
- Grouped
- Alphabetic
- By Inheritance
- DatomicEntity_Peer
- Serializable
- Serializable
- Product
- Equals
- DatomicEntity
- Quoted
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Type Members
-
case class
RetractMolecule(txMeta: MoleculeBase) extends Product with Serializable
Wrapper to add retract methods on entity with transaction meta data.
Wrapper to add retract methods on entity with transaction meta data.
RetractMolecule is created from callingTx:val benId = Person.name("Ben").Tx(MyMetaData.action("add member")).save.eid // Retract entity with tx meta data benId.Tx(MyMetaData.action("moved away")).retract // Query for Ben's history and why he was retracted Person(benId).name.t.op.Tx(MyMetaData.action).getHistory === List( ("Ben", 1028, true, "add member"), // Ben added as member ("Ben", 1030, false, "moved away") // Ben retracted since he moved away )
- txMeta
A molecule with transaction meta data to be saved with entity retraction
- Definition Classes
- DatomicEntity
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
-
def
Tx(txMeta: MoleculeBase): RetractMolecule
Entity retraction transaction meta data constructor.
Entity retraction transaction meta data constructor.
Build on from entity withTxand apply a transaction meta data molecule to save transaction meta data with retraction of the entity.val benId = Person.name("Ben").Tx(MyMetaData.action("add member")).save.eid // Retract entity with tx meta data benId.Tx(MyMetaData.action("moved away")).retract // Query for Ben's history and why he was retracted Person(benId).name.t.op.Tx(MyMetaData.action).getHistory === List( ("Ben", 1028, true, "add member"), // Ben added as member ("Ben", 1030, false, "moved away") // Ben retracted since he moved away )
- returns
RetractMolecule - a simple wrapper for adding retraction tx meta data
- Definition Classes
- DatomicEntity
-
def
apply(kw1: String, kw2: String, kws: String*): List[Option[Any]]
Get List of two or more unchecked/untyped attribute values of entity.
Get List of two or more unchecked/untyped attribute values of entity.
Apply two or more namespaced attribute names to return a List of unchecked/untyped optional attribute values.
Referenced entities can be cast to an Option[Map[String, Any]].val List(benId, benAddressId) = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eids // Type ascription is still unchecked since it is eliminated by erasure val List( optName: Option[String], optAge: Option[Int], optAddress: Option[Map[String, Any]] ) = benId( ":Person/name", ":Person/age", ":Person/address" ) val name: String = optName.getOrElse("no name") // Type casting necessary to get right value type from Map[String, Any] val address: Map[String, Any] = optAddress.getOrElse(Map.empty[String, Any]) val street: String = address.getOrElse(":Address/street", "no street").asInstanceOf[String] name === "Ben" street === "Hollywood Rd"
Typed apply is likely more convenient if typed values are required.
- kw1
First namespaced attribute name: ":[namespace with lowercase first letter]/[attribute name]"
- kw2
Second namespaced attribute name
- kws
Further namespaced attribute names
- returns
List of optional unchecked/untyped attribute values
- Definition Classes
- DatomicEntity
-
def
apply[T](key: String): Option[T]
Get typed attribute value of entity.
Get typed attribute value of entity.
Apply namespaced attribute name with a type parameter to return an optional typed value.
Note how referenced entities are returned as a Map so that we can continue traverse the entity graph.val List(benId, benAddressId) = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eids // Level 1 benId[String](":Person/name") === Some("Ben") benId[Int](":Person/age") === Some(42) // Level 2 val refMap = benId[Map[String, Any]](":Person/address").getOrElse(Map.empty[String, Any]) benAddressId[String](":Address/street") === Some("Hollywood Rd") // Non-asserted or non-existing attribute returns None benId[Int](":Person/non-existing-attribute") === None benId[Int](":Person/existing-but-non-asserted-attribute") === None
- T
Type of attribute
- key
Attribute: ":ns/attr"
- returns
Optional typed attribute value
- Definition Classes
- DatomicEntity
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asList(depth: Int, maxDepth: Int): List[(String, Any)]
- Attributes
- protected
- Definition Classes
- DatomicEntity
-
def
asMap(depth: Int, maxDepth: Int): Map[String, Any]
- Attributes
- protected
- Definition Classes
- DatomicEntity
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- val conn: Conn_Peer
- val eid: Any
- val entity: Entity
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
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
getRetractTx: List[List[RetractEntity]]
Get entity retraction transaction data without affecting the database.
Get entity retraction transaction data without affecting the database.
CallgetRetractTxto retrieve the generated transaction data of the methodretracton an entity// Get entity id of Ben val benId = Person.e.name_("Ben").get.head // Retraction transaction data benId.getRetractTx === List(List(RetractEntity(17592186045445)))
- returns
List[List[Retractentity[Long]]]
- Definition Classes
- DatomicEntity
-
lazy val
ident: Keyword
- Attributes
- protected
- Definition Classes
- DatomicEntity
-
def
inspectRetract: Unit
Inspect entity transaction data of method
retractwithout affecting the database.Inspect entity transaction data of method
retractwithout affecting the database.// Inspect retraction of an entity eid.inspectRetractThis will print generated Datomic transaction statements in a readable format to output:
## 1 ## Inspect `retract` on entity ======================================================================== 1 List( 1 List( 1 :db/retractEntity 17592186045445)) ========================================================================
- Definition Classes
- DatomicEntity
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
keySet: Set[String]
- Definition Classes
- DatomicEntity_Peer → DatomicEntity
-
def
keys: List[String]
- Definition Classes
- DatomicEntity_Peer → DatomicEntity
-
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()
-
def
quote(value: Any): String
- Attributes
- protected
- Definition Classes
- Quoted
-
def
quote2(value: Any): String
- Attributes
- protected
- Definition Classes
- Quoted
-
def
rawValue(key: String): Any
- Definition Classes
- DatomicEntity_Peer → DatomicEntity
-
def
retract: 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:// Get entity id of Ben val benId = Person.e.name_("Ben").get.head // Retract Ben entity benId.retract
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.- returns
molecule.datomic.base.facade.TxReport with result of retraction
- Definition Classes
- DatomicEntity
-
def
retractAsync(implicit ec: ExecutionContext): Future[TxReport]
Asynchronously retract single entity using entity id.
Asynchronously 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 callretractAsyncon an entity id directly:// Get entity id of Ben val benId = Person.e.name_("Ben").get.head // Retract Ben entity asynchronously benId.retractAsync.map { tx => // ..ben was retracted }
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.- returns
molecule.datomic.base.facade.TxReport with result of retraction
- Definition Classes
- DatomicEntity
- val showKW: Boolean
-
def
sortList(l: List[Any]): List[Any]
- Definition Classes
- DatomicEntity
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
touch: 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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid benId.touch === Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> Map( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" )
- returns
Map[key: String, value: Any] where value can be a primitive or another nested Map of the entity graph
- Definition Classes
- DatomicEntity
-
def
touchList: List[(String, Any)]
Get entity graph as List.
Get entity graph as List.
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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid benId.touchList === List( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> List( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" )
- returns
List[(key: String, value: Any)] where value can be a primitive or another nested List of the entity graph
- Definition Classes
- DatomicEntity
-
def
touchListMax(maxDepth: Int): List[(String, Any)]
Get entity graph to some depth as List.
Get entity graph to some depth as List.
- 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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid // 2 levels returned benId.touchListMax(2) === List( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> List( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" ) // 1 level returned benId.touchListMax(1) === List( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> 17592186045446L // Only reference returned ":Person/name" -> "Ben" )
- returns
List[(key: String, value: Any)] where value can be a primitive or another nested Map of the entity graph
- Definition Classes
- DatomicEntity
- To do
remove overload hack (by avoiding implicit apply method of scala.collection.LinearSeqOptimized ?)
-
def
touchListQuoted: String
Get entity graph as List-string (for tests).
Get entity graph as List-string (for tests).
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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid benId.touchListQuoted === """List( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> List( | ":db/id" -> 17592186045446L, | ":Address/street" -> "Hollywood Rd"), | ":Person/name" -> "Ben")""",stripMargin
- returns
String
- Definition Classes
- DatomicEntity
-
def
touchListQuotedMax(maxDepth: Int): String
Get entity graph to some depth as List-string (for tests).
Get entity graph to some depth as List-string (for tests).
- 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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid // 2 levels (in this case all levels) returned benId.touchListQuotedMax(2) === """List( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> List( | ":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.touchListQuotedMax(1) === """List( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> 17592186045446L, | ":Person/name" -> "Ben")""",stripMargin
- returns
String
- Definition Classes
- DatomicEntity
-
def
touchMax(maxDepth: Int): 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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid // 2 levels returned benId.touchMax(2) === Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> Map( ":db/id" -> 17592186045446L, ":Address/street" -> "Hollywood Rd"), ":Person/name" -> "Ben" ) // 1 level returned benId.touchMax(1) === Map( ":db/id" -> 17592186045445L, ":Person/age" -> 42, ":Person/address" -> 17592186045446L // Only reference returned ":Person/name" -> "Ben" )
- returns
Map[key: String, value: Any] where value can be a primitive or another nested Map of the entity graph
- Definition Classes
- DatomicEntity
-
def
touchQuoted: String
Get entity graph as Map-string (for presentation).
Get 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. Pasting it into test code is less useful, since the order of key/value pairs in a Map is not guaranteed. In that case,touchListQuotedis recommended since a List guarantees order.
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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid benId.touchQuoted === """Map( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> Map( | ":db/id" -> 17592186045446L, | ":Address/street" -> "Hollywood Rd"), | ":Person/name" -> "Ben")""".stripMargin
- returns
String
- Definition Classes
- DatomicEntity
-
def
touchQuotedMax(maxDepth: Int): String
Get entity graph to some depth as Map-string (for presentation).
Get 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. Pasting it into test code is less useful, since the order of key/value pairs in a Map is not guaranteed. In that case,touchListQuoted(maxLevel)is recommended since a List guarantees order.- 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.
val benId = Person.name.age.Address.street.insert("Ben", 42, "Hollywood Rd").eid // 2 levels (in this case all levels) returned benId.touchQuotedMax(2) === """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.touchQuotedMax(1) === """Map( | ":db/id" -> 17592186045445L, | ":Person/age" -> 42, | ":Person/address" -> 17592186045446L, | ":Person/name" -> "Ben")""".stripMargin
- returns
String
- Definition Classes
- DatomicEntity
-
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