trait InputMolecule extends MoleculeBase
Shared interface of all input molecules.
Input molecules are molecules that awaits one or more inputs at runtime. When input value is applied,
the input molecule is resolved and a standard molecule is returned that we can then call actions on.
Input molecule queries are cached by Datomic. So there is a runtime performance gain in using input molecules. Furthermore,
input molecules are a good fit for re-use for queries where only a few parameters change.
Input molecules can await 1, 2 or 3 inputs and are constructed by applying the ? marker
to attributes. If one marker is applied, we get a InputMolecule_1, 2 inputs creates
an InputMolecule_3 and 3 an InputMolecule_3.
The three input molecule interfaces come in arity-versions corresponding to the number of non-?-marked attributes
in the input molecule. Let's see a simple example:
// Sample data Person.name.age insert List( ("Joe", 42), ("Liz", 34) ) // Input molecule created at compile time. Awaits a name of type String val ageOfPersons: InputMolecule_1.InputMolecule_1_01[String, Int] = m(Person.name_(?).age) // Resolved molecule. "Joe" input is matched against name attribute val ageOfPersonsNamedJoe: Molecule.Molecule01[Int] = ageOfPersons.apply("Joe") // Calling action on resolved molecule. // (Only age is returned since name was marked as tacit with the underscore notation) ageOfPersonsNamedJoe.get === List(42) // Or we can re-use the input molecule straight away ageOfPersons("Liz").get === List(34)
- Source
- InputMolecule.scala
- See also
- Grouped
- Alphabetic
- By Inheritance
- InputMolecule
- MoleculeBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
val
_model: Model
Internal Model representation of molecule.
Internal Model representation of molecule.
Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:
Custom DSL molecule --> Model --> Query --> Datomic query string- Definition Classes
- MoleculeBase
-
abstract
val
_nestedQuery: Option[Query]
Internal optional Query representation of nested molecule with added entity search for each level.
Internal optional Query representation of nested molecule with added entity search for each level.
Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:
Custom DSL molecule --> Model --> Query --> Datomic query string- Definition Classes
- MoleculeBase
-
abstract
val
_query: Query
Internal Query representation of molecule.
Internal Query representation of molecule.
Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:
Custom DSL molecule --> Model --> Query --> Datomic query string- Definition Classes
- MoleculeBase
-
abstract
val
_rawNestedQuery: Option[Query]
Internal un-optimized optional Query representation of nested molecule with added entity search for each level.
Internal un-optimized optional Query representation of nested molecule with added entity search for each level.
Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:
Custom DSL molecule --> Model --> Query --> Datomic query string- Definition Classes
- MoleculeBase
-
abstract
val
_rawQuery: Query
Internal un-optimized Query representation molecule.
Internal un-optimized Query representation molecule.
Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:
Custom DSL molecule --> Model --> Query --> Datomic query string- Definition Classes
- MoleculeBase
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
-
def
addNilClause(clauses: Seq[Clause], e: Var, kw: KW, v0: Var): Seq[Clause]
- Attributes
- protected
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
cardinality(nsFull: String, attr: String): Int
- Attributes
- protected
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
dataClause(e: String, kw: KW, enumPrefix: Option[String], arg: Any, i: Int): Seq[Clause]
- Attributes
- protected
-
def
deepNil(args: Seq[Any]): Boolean
- Attributes
- protected
-
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()
-
def
isExpression(nsFull: String, attr: String): Boolean
- Attributes
- protected
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isTacit(nsFull: String, attr: String): Boolean
- Attributes
- protected
-
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
pre[T](enumPrefix: Option[String], arg: T): Any
- Attributes
- protected
-
def
resolveInput[T](query: Query, ph: Placeholder, inputs: Seq[T], ruleName: String = "rule1", unifyRule: Boolean = false): Query
- Attributes
- protected
-
def
resolveOr[I1](or: Or[I1]): Seq[I1]
- Attributes
- protected
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueClauses[TT](e: String, kw: KW, enumPrefix: Option[String], args: TT): Seq[Clause]
- Attributes
- protected
-
def
varsAndPrefixes(query: Query): Seq[(Var, String)]
- Attributes
- protected
-
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.
Manual | scalamolecule.org | Github | Forum