Packages

  • package root

    Documentation/API for the Molecule library - a meta DSL for the Datomic database.

    scalamolecule.org | Github | Forum

    Definition Classes
    root
  • package molecule

    Molecule library - a Scala meta-DSL for the Datomic database.

    Molecule library - a Scala meta-DSL for the Datomic database.

    Definition Classes
    root
  • package core
    Definition Classes
    molecule
  • package api
    Definition Classes
    core
  • package getObj

    Synchronous getter methods to retrieve data as objects.

    Synchronous getter methods to retrieve data as objects.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.

    Molecule has 3 groups of synchronous object getters, each returning data in various formats:

    • GetObjArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetObjIterable - for lazily traversing row by row
    • GetObjList - default getter returning Lists of objects. Convenient typed data, suitable for smaller data sets

    Getters in each of the 5 groups come with 5 time-dependent variations:

    • get [current data]
    • getAsOf
    • getSince
    • getWith
    • getHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent asynchronous getters in the getAsyncTpl package.

  • GetObjArray
  • GetObjIterable
  • GetObjList

trait GetObjList[Obj, Tpl] extends GetObjArray[Obj, Tpl] with JavaUtil with Quoted

Data getter methods on molecules that return List[Obj].

For expected smaller result sets it's convenient to return Lists of objects of data.

Self Type
Molecule_0[Obj, Tpl]
Source
GetObjList.scala
Linear Supertypes
Quoted, GetObjArray[Obj, Tpl], JavaUtil, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. GetObjList
  2. Quoted
  3. GetObjArray
  4. JavaUtil
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. implicit class raw2list extends AnyRef
    Definition Classes
    JavaUtil

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 getObj(implicit conn: Conn): Obj

    Convenience method to get head of list of objects matching molecule.

    Convenience method to get head of list of objects matching molecule.

    val person = Person.name.age.getObj
    person.name === "Ben"
    person.age  === 42
    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object with properties matching the attributes of the molecule

  11. def getObjArray(n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule.

    Get Array of n rows as objects matching molecule.

    Person.name.age.getObjArray(1).map(p => s"${p.name} is ${p.age} years old")) === List(
      "Ben is 42 years old"
    )

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects. Setting n to -1 fetches all rows (same as calling getObjArray without any number of rows parameter).

    n

    Number of rows. If -1, all rows are fetched.

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of types matching the attributes of the molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArray method.

  12. def getObjArray(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule.

    Get Array of all rows as objects matching molecule.

    val persons = Person.name.age.getObjArray
    
    // Fast while loop
    var i = 0
    val length = persons.length
    while(i < length) {
      val p = persons(i)
      println(s"${p.name} is ${p.age} years old") // Do stuff with row object...
      i += 1
    }

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of types matching the attributes of the molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncObjArray method.

  13. def getObjArrayAsOf(date: Date, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule as of date.

    Get Array of n rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    val beforeInsert = new java.util.Date
    
    // Insert
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    val afterInsert = new java.util.Date
    
    // Update
    val tx2 = Person(ben).age(43).update
    val afterUpdate = new java.util.Date
    
    // Get Array of all rows as of afterUpdate
    val persons = Person.name.age.getObjArrayAsOf(afterUpdate)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of n rows as of afterUpdate
    val persons = Person.name.age.getObjArrayAsOf(afterUpdate, 1)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  14. def getObjArrayAsOf(date: Date)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule as of date.

    Get Array of all rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    val beforeInsert = new java.util.Date
    
    // Insert
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    val afterInsert = new java.util.Date
    
    // Update
    val tx2 = Person(ben).age(43).update
    val afterUpdate = new java.util.Date
    
    // Retract
    val tx3 = ben.retract
    val afterRetract = new java.util.Date
    
    // No data yet before insert
    Person.name.age.getObjArrayAsOf(beforeInsert) === Array()
    
    // Get Array of all rows as of afterInsert
    val persons = Person.name.age.getObjArrayAsOf(afterInsert)
    persons(0).name === "Ben"
    persons(0).age  === 42
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of all rows as of afterUpdate
    val persons = Person.name.age.getObjArrayAsOf(afterUpdate)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of all rows as of afterRetract
    val persons = Person.name.age.getObjArrayAsOf(afterRetract)
    persons(0).name === "Liz"
    persons(0).age  === 37

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    date

    java.util.Date

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  15. def getObjArrayAsOf(tx: TxReport, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule as of tx.

    Get Array of n rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    // Insert (tx report 1)
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    
    // Update (tx report 2)
    val tx2 = Person(ben).age(43).update
    
    // Get Array of all rows as of tx2 (after update)
    val persons = Person.name.age.getObjArrayAsOf(tx2)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of n rows as of tx2 (after update)
    val persons = Person.name.age.getObjArrayAsOf(tx2, 1)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    tx

    TxReport (returned from all molecule transaction operations)

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  16. def getObjArrayAsOf(tx: TxReport)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule as of tx.

    Get Array of all rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    // Insert (tx report 1)
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    
    // Update (tx report 2)
    val tx2 = Person(ben).age(43).update
    
    // Retract (tx report 3)
    val tx3 = ben.retract
    
    // Get Array of all rows as of tx1 (after insert)
    val persons = Person.name.age.getObjArrayAsOf(tx1)
    persons(0).name === "Ben"
    persons(0).age  === 42
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of all rows as of tx2 (after update)
    val persons = Person.name.age.getObjArrayAsOf(tx2)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of all rows as of tx3 (after retract)
    val persons = Person.name.age.getObjArrayAsOf(tx3)
    persons(0).name === "Liz"
    persons(0).age  === 37

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    tx

    TxReport (returned from all molecule transaction operations)

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  17. def getObjArrayAsOf(t: Long, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule as of transaction time t.

    Get Array of n rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    // Insert (t 1028)
    val List(ben, liz) = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    ) eids
    
    // Update (t 1031)
    Person(ben).age(43).update
    
    // History of Ben
    Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)) === List(
      (42, 1028, true),  // Insert:  42 asserted
      (42, 1031, false), // Update:  42 retracted
      (43, 1031, true),  //          43 asserted
    )
    
    // Get Array of all rows as of transaction t 1031 (after update)
    val persons = Person.name.age.getObjArrayAsOf(1031)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of n rows as of transaction t 1031 (after update)
    val persons = Person.name.age.getObjArrayAsOf(1031)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    t

    Long Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  18. def getObjArrayAsOf(t: Long)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule as of transaction time t.

    Get Array of all rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    // Insert (t 1028)
    val List(ben, liz) = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    ) eids
    
    // Update (t 1031)
    Person(ben).age(43).update
    
    // Retract (t 1032)
    ben.retract
    
    // History of Ben
    Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)) === List(
      (42, 1028, true),  // Insert:  42 asserted
      (42, 1031, false), // Update:  42 retracted
      (43, 1031, true),  //          43 asserted
      (43, 1032, false)  // Retract: 43 retracted
    )
    
    // Get Array of data as of transaction t 1028 (after insert)
    val persons = Person.name.age.getObjArrayAsOf(1028)
    persons(0).name === "Ben"
    persons(0).age  === 42
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of data as of transaction t 1031 (after update)
    val persons = Person.name.age.getObjArrayAsOf(1031)
    persons(0).name === "Ben"
    persons(0).age  === 43 // <-- updated
    persons(1).name === "Liz"
    persons(1).age  === 37
    
    // Get Array of all rows as of transaction t 1032 (after retract)
    val persons = Person.name.age.getObjArrayAsOf(1032)
    persons(0).name === "Liz"
    persons(0).age  === 37

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the typed data set.

    t

    Transaction time t

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayAsOf method.

  19. def getObjArraySince(date: Date, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule since date.

    Get Array of n rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
    val date1 = Person.name("Ann").save.inst
    val date2 = Person.name("Ben").save.inst
    val date3 = Person.name("Cay").save.inst
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since date1
    val persons = Person.name.getObjArraySince(date1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Ben and Cay added since date1 - only n (1) rows returned
    val persons = Person.name.getObjArraySince(date1, 1)
    persons(0).name === "Ben"

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  20. def getObjArraySince(date: Date)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule since date.

    Get Array of all rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
    val date1 = Person.name("Ann").save.inst
    val date2 = Person.name("Ben").save.inst
    val date3 = Person.name("Cay").save.inst
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since date1
    val persons = Person.name.getObjArraySince(date1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Cay added since transaction time date2
    val persons = Person.name.getObjArraySince(date2)
    persons(0).name === "Cay"
    
    // Nothing added since transaction time date3
    Person.name.getObjArraySince(date3) === Array()

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    date

    java.util.Date

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  21. def getObjArraySince(tx: TxReport, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule since tx.

    Get Array of n rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsync a TxReport from transaction operations like get, update, retract etc.

    // Get tx reports for 3 transactions
    val tx1 = Person.name("Ann").save
    val tx2 = Person.name("Ben").save
    val tx3 = Person.name("Cay").save
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since tx1
    val persons = Person.name.getObjArraySince(tx1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Ben and Cay added since tx1 - only n (1) rows returned
    val persons = Person.name.getObjArraySince(tx1, 1)
    persons(0).name === "Ben"

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    tx

    TxReport

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  22. def getObjArraySince(tx: TxReport)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule since tx.

    Get Array of all rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsync a TxReport from transaction operations like get, update, retract etc.

    // Get tx reports for 3 transactions
    val tx1 = Person.name("Ann").save
    val tx2 = Person.name("Ben").save
    val tx3 = Person.name("Cay").save
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since transaction time tx1
    val persons = Person.name.getObjArraySince(tx1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Cay added since transaction time tx2
    val persons = Person.name.getObjArraySince(tx2)
    persons(0).name === "Cay"
    
    // Nothing added since transaction time tx3
    Person.name.getObjArraySince(tx3) === Array()

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    tx

    TxReport

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  23. def getObjArraySince(t: Long, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule since transaction time t.

    Get Array of n rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    // 3 transaction times `t`
    val t1 = Person.name("Ann").save.t
    val t2 = Person.name("Ben").save.t
    val t3 = Person.name("Cay").save.t
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since transaction time t1
    val persons = Person.name.getObjArraySince(t1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Ben and Cay added since transaction time t1 - only n (1) rows returned
    val persons = Person.name.getObjArraySince(t1, 1)
    persons(0).name === "Ben"

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    t

    Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  24. def getObjArraySince(t: Long)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule since transaction time t.

    Get Array of all rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    // 3 transaction times `t`
    val t1 = Person.name("Ann").save.t
    val t2 = Person.name("Ben").save.t
    val t3 = Person.name("Cay").save.t
    
    // Current values
    val persons = Person.name.getObjArray
    persons(0).name === "Ann"
    persons(1).name === "Ben"
    persons(2).name === "Cay"
    
    // Ben and Cay added since transaction time t1
    val persons = Person.name.getObjArraySince(t1)
    persons(0).name === "Ben"
    persons(1).name === "Cay"
    
    // Cay added since transaction time t2
    val persons = Person.name.getObjArraySince(t2)
    persons(0).name === "Cay"
    
    // Nothing added since transaction time t3
    Person.name.getObjArraySince(t3) === Array()

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    t

    Transaction time t

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArraySince method.

  25. def getObjArrayWith(txData: List[_], n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule with applied raw transaction data.

    Get Array of n rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db to see how it would then look:

    // Live size of Person db
    Person.name.get.size === 150
    
    // Read some transaction data from file
    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val newDataTx = Util.readAll(data_rdr2).get(0).asInstanceOf[java.util.List[Object]]
    
    // Imagine future db - 100 persons would be added, apparently
    Person.name.getObjArrayWith(newDataTx).size === 250
    
    // Imagine future db - Let's just take 10
    Person.name.getObjArrayWith(newDataTx, 10).size === 10

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    txData

    Raw transaction data as java.util.List[Object]

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayWith method.

  26. def getObjArrayWith(txData: List[_])(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule with applied raw transaction data.

    Get Array of all rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db to see how it would then look:

    // Live size of Person db
    Person.name.get.size === 150
    
    // Read some transaction data from file
    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val newDataTx = Util.readAll(data_rdr2).get(0).asInstanceOf[java.util.List[Object]]
    
    // Imagine future db - 100 persons would be added, apparently
    Person.name.getObjArrayWith(newDataTx).size === 250

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    txData

    Raw transaction data as java.util.List[Object]

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayWith method.

  27. def getObjArrayWith(n: Int, txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of n rows as objects matching molecule with applied molecule transaction data.

    Get Array of n rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    // Current state
    val List(ben, liz) = Person.name.likes.insert(
      ("Ben", "pasta"),
      ("Liz", "pizza")
    ).eids
    
    // Current state
    val persons = Person.name.likes.getObjArray
    persons(0).name  === "Ben"
    persons(0).likes === "pasta"
    persons(1).name  === "Liz"
    persons(1).likes === "pizza"
    
    // Test adding transaction data
    val personsTest = Person.name.likes.getObjArrayWith(
      Person(ben).likes("sushi").getUpdateTx,
      Person(liz).likes("cake").getUpdateTx
    )
    // Effect: sushi and cake now liked
    personsTest(0).name  === "Ben"
    personsTest(0).likes === "sushi"
    personsTest(1).name  === "Liz"
    personsTest(1).likes === "cake"
    
    // Same as above, but only n (1) rows returned:
    val personsTest1 = Person.name.likes.getObjArrayWith(
      1
      Person(ben).likes("sushi").getUpdateTx,
      Person(liz).likes("cake").getUpdateTx
    )
    // Effect: sushi and cake now liked (but only Ben returned)
    personsTest1(0).name  === "Ben"
    personsTest1(0).likes === "sushi"
    
    // Current state is still the same
    val personsAfter = Person.name.likes.getObjArray
    personsAfter(0).name  === "Ben"
    personsAfter(0).likes === "pasta"
    personsAfter(1).name  === "Liz"
    personsAfter(1).likes === "pizza"

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    n

    Int Number of rows returned

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    Note

    Note how the n parameter has to come before the txMolecules vararg.

    See also

    Equivalent asynchronous getAsyncArrayWith method.

  28. def getObjArrayWith(txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Array[Obj]

    Get Array of all rows as objects matching molecule with applied molecule transaction data.

    Get Array of all rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    // Current state
    val ben = Person.name("Ben").likes("pasta").save.eid
    
    val persons = Person.name.likes.getObjArray
    persons(0).name  === "Ben"
    persons(0).likes === "pasta"
    
    // Test adding transaction data
    val personsTest = Person.name.likes.getObjArrayWith(
      // Additional transaction data
      Person(ben).likes("sushi").getUpdateTx
    )
    
    // Effect: Ben would like sushi if tx was applied
    personTest(0).name  === "Ben"
    personTest(0).likes === "sushi"
    
    // Current state is still the same
    val personsAfter = Person.name.likes.getObjArray
    personsAfter(0).name  === "Ben"
    personsAfter(0).likes === "pasta"

    Multiple transactions can be applied to test more complex what-if scenarios!

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Array[Obj] where Obj is an object of data matching molecule

    Definition Classes
    GetObjArray
    See also

    Equivalent asynchronous getAsyncArrayWith method.

  29. def getObjList(n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule.

    Get List of n rows as objects matching molecule.

    Only n rows are type-casted.

    val List(p1) = Person.name.age.getObjList(1)
    p1.name === "Ben"
    p1.age  === 42
    n

    Int Number of rows returned. If n == -1, all rows are returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object with properties matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjList method.

  30. def getObjList(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule.

    Get List of all rows as objects matching molecule.

    val List(p1, p2) = Person.name.age.getObjList
    p1.name === "Ben"
    p1.age  === 42
    p2.name === "Liz"
    p2.age  === 37
    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object with properties matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjList method.

  31. def getObjListAsOf(date: Date, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule as of date.

    Get List of n rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    val beforeInsert = new java.util.Date
    
    // Insert
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    val afterInsert = new java.util.Date
    
    // Update
    val tx2 = Person(ben).age(43).update
    val afterUpdate = new java.util.Date
    
    
    // Get List of all rows as of afterUpdate
    val List(a1, a2) = Person.name.age.getObjListAsOf(afterUpdate)
    a1.name === "Ben"
    a1.age  === 43 // <-- updated
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of n rows as of afterUpdate
    val List(b1) = Person.name.age.getObjListAsOf(afterUpdate, 1)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  32. def getObjListAsOf(date: Date)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule as of date.

    Get List of all rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    val beforeInsert = new java.util.Date
    
    // Insert
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37),
    )
    val List(ben, liz) = tx1.eids
    val afterInsert = new java.util.Date
    
    // Update
    val tx2 = Person(ben).age(43).update
    val afterUpdate = new java.util.Date
    
    // Retract
    val tx3 = ben.retract
    val afterRetract = new java.util.Date
    
    
    // No data yet before insert
    Person.name.age.getObjListAsOf(beforeInsert) === List()
    
    // Get List of all rows as of afterInsert
    val List(a1, a2) = Person.name.age.getObjListAsOf(afterInsert)
    a1.name === "Ben"
    a1.age  === 42
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of all rows as of afterUpdate
    val List(b1, b2) = Person.name.age.getObjListAsOf(afterUpdate)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    b2.name === "Liz"
    b2.age  === 37
    
    // Get List of all rows as of afterRetract
    val List(c1) = Person.name.age.getObjListAsOf(afterRetract)
    c1.name === "Liz"
    c1.age  === 37
    date

    java.util.Date

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  33. def getObjListAsOf(tx: TxReport, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule as of tx.

    Get List of n rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    // Insert (tx report 1)
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37)
    )
    val List(ben, liz) = tx1.eids
    
    // Update (tx report 2)
    val tx2 = Person(ben).age(43).update
    
    
    // Get List of all rows as of tx2 (after update)
    val List(a1, a2) = Person.name.age.getObjListAsOf(tx2)
    a1.name === "Ben"
    a1.age  === 43 // <-- updated
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of n rows as of tx2 (after update)
    val List(b1) = Person.name.age.getObjListAsOf(tx2, 1)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    tx

    TxReport (returned from all molecule transaction operations)

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  34. def getObjListAsOf(tx: TxReport)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule as of tx.

    Get List of all rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    // Insert (tx report 1)
    val tx1 = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37),
    )
    val List(ben, liz) = tx1.eids
    
    // Update (tx report 2)
    val tx2 = Person(ben).age(43).update
    
    // Retract (tx report 3)
    val tx3 = ben.retract
    
    // Get List of all rows as of tx1 (after insert)
    val List(a1, a2) = Person.name.age.getObjListAsOf(tx1)
    a1.name === "Ben"
    a1.age  === 42
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of all rows as of tx2 (after update)
    val List(b1, b2) = Person.name.age.getObjListAsOf(tx2)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    b2.name === "Liz"
    b2.age  === 37
    
    // Get List of all rows as of tx3 (after retract)
    val List(c1) = Person.name.age.getObjListAsOf(tx3)
    c1.name === "Liz"
    c1.age  === 37
    tx

    TxReport (returned from all molecule transaction operations)

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  35. def getObjListAsOf(t: Long, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule as of transaction time t.

    Get List of n rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    // Insert (t 1028)
    val List(ben, liz) = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37),
    ) eids
    
    // Update (t 1031)
    Person(ben).age(43).update
    
    // History of Ben
    Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)) === List(
      (42, 1028, true),  // Insert:  42 asserted
      (42, 1031, false), // Update:  42 retracted
      (43, 1031, true),  //          43 asserted
    )
    
    // Get List of all rows as of transaction t 1031 (after update)
    val List(a1, a2) = Person.name.age.getObjListAsOf(1031)
    a1.name === "Ben"
    a1.age  === 43 // <-- updated
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of n rows as of transaction t 1031 (after update)
    val List(b1) = Person.name.age.getObjListAsOf(1031)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    t

    Long Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  36. def getObjListAsOf(t: Long)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule as of transaction time t.

    Get List of all rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    // Insert (t 1028)
    val List(ben, liz) = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37),
    ) eids
    
    // Update (t 1031)
    Person(ben).age(43).update
    
    // Retract (t 1032)
    ben.retract
    
    // History of Ben
    Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)) === List(
      (42, 1028, true),  // Insert:  42 asserted
      (42, 1031, false), // Update:  42 retracted
      (43, 1031, true),  //          43 asserted
      (43, 1032, false)  // Retract: 43 retracted
    )
    
    // Get List of data as of transaction t 1028 (after insert)
    val List(a1, a2) = Person.name.age.getObjListAsOf(1028)
    a1.name === "Ben"
    a1.age  === 42
    a2.name === "Liz"
    a2.age  === 37
    
    // Get List of data as of transaction t 1031 (after update)
    val List(b1, b2) = Person.name.age.getObjListAsOf(1031)
    b1.name === "Ben"
    b1.age  === 43 // <-- updated
    b2.name === "Liz"
    b2.age  === 37
    
    // Get List of all rows as of transaction t 1032 (after retract)
    val List(c1) = Person.name.age.getObjListAsOf(1032)
    c1.name === "Liz"
    c1.age  === 37
    t

    Transaction time t

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListAsOf method.

  37. def getObjListHistory(implicit conn: Conn): List[Obj]

    Get history of operations as List on an attribute in the db.

    Get history of operations as List on an attribute in the db.

    Generic datom attributes that can be called when getHistory is called:

    e - Entity id
    a - Attribute name
    v - Attribute value
    ns - Namespace name
    tx - TxReport
    t - Transaction time t
    txInstant - Transaction time as java.util.Date
    op - Operation: true (add) or false (retract)

    Example:

    // Insert (t 1028)
    val List(ben, liz) = Person.name.age insert List(
      ("Ben", 42),
      ("Liz", 37),
    ) eids
    
    // Update (t 1031)
    Person(ben).age(43).update
    
    // Retract (t 1032)
    ben.retract
    
    // History of Ben
    Person(ben).age.t.op.getObjListHistory
      .sortBy(o => (o.t, o.op))
      .map(o => s"${o.age} ${o.t} ${o.op}") === List(
      "42 1028 true",  // Insert:  42 asserted
      "42 1031 false", // Update:  42 retracted
      "43 1031 true",  //          43 asserted
      "43 1032 false"  // Retract: 43 retracted
    )
    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListHistory method.

  38. def getObjListSince(date: Date, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule since date.

    Get List of n rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
    val date1 = Person.name("Ann").save.inst
    val date2 = Person.name("Ben").save.inst
    val date3 = Person.name("Cay").save.inst
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since date1
    val List(b1, b2) = Person.name.getObjListSince(date1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Ben and Cay added since date1 - only n (1) rows returned
    val List(c1) = Person.name.getObjListSince(date1, 1)
    c1.name === "Ben"
    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  39. def getObjListSince(date: Date)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule since date.

    Get List of all rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
    val date1 = Person.name("Ann").save.inst
    val date2 = Person.name("Ben").save.inst
    val date3 = Person.name("Cay").save.inst
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since date1
    val List(b1, b2) = Person.name.getObjListSince(date1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Cay added since transaction time date2
    val List(c1) = Person.name.getObjListSince(date2)
    c1.name === "Cay"
    
    // Nothing added since transaction time date3
    Person.name.getObjListSince(date3) === List()
    date

    java.util.Date

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  40. def getObjListSince(tx: TxReport, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule since tx.

    Get List of n rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsyncObjList a TxReport from transaction operations like get, update, retract etc.

    // Get tx reports for 3 transactions
    val tx1 = Person.name("Ann").save
    val tx2 = Person.name("Ben").save
    val tx3 = Person.name("Cay").save
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since tx1
    val List(b1, b2) = Person.name.getObjListSince(tx1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Ben and Cay added since tx1 - only n (1) rows returned
    val List(c1) = Person.name.getObjListSince(tx1, 1)
    c1.name === "Ben"
    tx

    TxReport

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  41. def getObjListSince(tx: TxReport)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule since tx.

    Get List of all rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsyncObjList a TxReport from transaction operations like get, update, retract etc.

    // Get tx reports for 3 transactions
    val tx1 = Person.name("Ann").save
    val tx2 = Person.name("Ben").save
    val tx3 = Person.name("Cay").save
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since transaction time tx1
    val List(b1, b2) = Person.name.getObjListSince(tx1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Cay added since transaction time tx2
    val List(c1) = Person.name.getObjListSince(tx2)
    c1.name === "Cay"
    
    // Nothing added since transaction time tx3
    Person.name.getObjListSince(tx3) === List()
    tx

    TxReport

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  42. def getObjListSince(t: Long, n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule since transaction time t.

    Get List of n rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    // 3 transaction times `t`
    val t1 = Person.name("Ann").save.t
    val t2 = Person.name("Ben").save.t
    val t3 = Person.name("Cay").save.t
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since transaction time t1
    val List(b1, b2) = Person.name.getObjListSince(t1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Ben and Cay added since transaction time t1 - only n (1) rows returned
    val List(c1) = Person.name.getObjListSince(t1, 1)
    c1.name === "Ben"
    t

    Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  43. def getObjListSince(t: Long)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule since transaction time t.

    Get List of all rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    // 3 transaction times `t`
    val t1 = Person.name("Ann").save.t
    val t2 = Person.name("Ben").save.t
    val t3 = Person.name("Cay").save.t
    
    
    // Current values
    val List(a1, a2, a3) = Person.name.getObjList
    a1.name === "Ann"
    a2.name === "Ben"
    a3.name === "Cay"
    
    // Ben and Cay added since transaction time t1
    val List(b1, b2) = Person.name.getObjListSince(t1)
    b1.name === "Ben"
    b2.name === "Cay"
    
    // Cay added since transaction time t2
    val List(c1) = Person.name.getObjListSince(t2)
    c1.name === "Cay"
    
    // Nothing added since transaction time t3
    Person.name.getObjListSince(t3) === List()
    t

    Transaction time t

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListSince method.

  44. def getObjListWith(txData: List[_], n: Int)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule with applied raw transaction data.

    Get List of n rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db to see how it would then look:

    // Live size of Person db
    Person.name.get.size === 150
    
    // Read some transaction data from file
    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val newDataTx = Util.readAll(data_rdr2).getObjList(0).asInstanceOf[java.util.List[Object]]
    
    // Imagine future db - 100 persons would be added, apparently
    Person.name.getWith(newDataTx).size === 250
    
    // Imagine future db - Let's just take 10
    Person.name.getWith(newDataTx, 10).size === 10
    txData

    Raw transaction data as java.util.List[Object]

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListWith method.

  45. def getObjListWith(txData: List[_])(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule with applied raw transaction data.

    Get List of all rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db to see how it would then look:

    // Live size of Person db
    Person.name.get.size === 150
    
    // Read some transaction data from file
    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val newDataTx = Util.readAll(data_rdr2).getObjList(0).asInstanceOf[java.util.List[Object]]
    
    // Imagine future db - 100 persons would be added, apparently
    Person.name.getWith(newDataTx).size === 250
    txData

    Raw transaction data as java.util.List[Object]

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListWith method.

  46. def getObjListWith(n: Int, txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn): List[Obj]

    Get List of n rows as objects matching molecule with applied molecule transaction data.

    Get List of n rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    // Current state
    val List(ben, liz) = Person.name.likes.insert(
      ("Ben", "pasta"),
      ("Liz", "pizza")
    ).eids
    val List(p1, p2) = Person.name.likes.getObjList
    p1.name  === "Ben"
    p1.likes === "pasta"
    p2.name  === "Liz"
    p2.likes === "pizza"
    
    
    // Test multiple transactions
    val List(testP1, testP2) = Person.name.likes.getObjListWith(
      Person(ben).likes("sushi").getUpdateTx,
      Person(liz).likes("cake").getUpdateTx
    )
    // Effect: sushi and cake now liked
    testP1.name  === "Ben"
    testP1.likes === "sushi"
    testP2.name  === "Liz"
    testP2.likes === "cake"
    
    // Same as above, but only n (1) rows returned:
    val List(oneTestP) = Person.name.likes.getObjListWith(
      1
      Person(ben).likes("sushi").getUpdateTx,
      Person(liz).likes("cake").getUpdateTx
    )
    // Effect: sushi and cake now liked (but only Ben returned)
    oneTestP.name  === "Ben"
    oneTestP.likes === "sushi"
    
    // Current state is still the same
    val List(p3, p4) = Person.name.likes.getObjList
    p3.name  === "Ben"
    p3.likes === "pasta"
    p4.name  === "Liz"
    p4.likes === "pizza"
    n

    Int Number of rows returned

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    Note

    Note how the n parameter has to come before the txMolecules vararg.

    See also

    Equivalent asynchronous getAsyncObjListWith method.

  47. def getObjListWith(txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn): List[Obj]

    Get List of all rows as objects matching molecule with applied molecule transaction data.

    Get List of all rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    // Current state
    val ben = Person.name("Ben").likes("pasta").save.eid
    
    val List(p0) = Person.name.likes.getObjList
    p0.name  === "Ben"
    p0.likes === "pasta"
    
    // Test adding transaction data
    val List(pTest) = Person.name.likes.getObjListWith(
      // Additional transaction data
      Person(ben).likes("sushi").getUpdateTx
    )
    // Effect: Ben would like sushi if tx was applied
    pTest.name  === "Ben"
    pTest.likes === "sushi"
    
    // Current state is still the same
    val List(pAfter) = Person.name.likes.getObjList
    pAfter.name  === "Ben"
    pAfter.likes === "pasta"

    Multiple transactions can be applied to test more complex what-if scenarios!

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object type having property types matching the attributes of the molecule

    See also

    Equivalent asynchronous getAsyncObjListWith method.

  48. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  49. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  50. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  51. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  52. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  53. def quote(value: Any): String
    Attributes
    protected
    Definition Classes
    Quoted
  54. def quote2(value: Any): String
    Attributes
    protected
    Definition Classes
    Quoted
  55. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  56. def toJavaList(scalaList: Seq[List[_]]): List[List[_]]
    Definition Classes
    JavaUtil
  57. def toString(): String
    Definition Classes
    AnyRef → Any
  58. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  61. object Util
    Definition Classes
    JavaUtil

Inherited from Quoted

Inherited from GetObjArray[Obj, Tpl]

Inherited from JavaUtil

Inherited from AnyRef

Inherited from Any

get

getAsOf

getHistory

getObjArrayAsOf

getObjArraySince

getObjArrayWith

getSince

getWith

Ungrouped